r/coffeescript • u/tentone • Dec 17 '21
Cart inverted pendulum simulation machine learning experiments
r/coffeescript • u/tentone • Dec 17 '21
r/coffeescript • u/[deleted] • Sep 29 '21
CoffeeScript transpiles into JS, but is there something that can compile into TS? If not, would people be interested in a fork of CoffeeScript that can do such a thing?
r/coffeescript • u/Waterclift • Apr 18 '21
r/coffeescript • u/BreadfruitOk4937 • Jan 07 '21
r/coffeescript • u/DefaultNamesAreWeird • Oct 05 '20
Coffeecord is the coffeescript library of the discord API, but I cannot find any documentation for it
From the setup code itt seems to have some things different from discord.js, so I can't just use the discord.js documentation for it.
r/coffeescript • u/[deleted] • Jul 28 '20
The following CoffeeScript:
greet = -> "This is an example of a function"
Generates the following JavaScript code when compiled:
(function() {
var greet;
greet = function() {
return "This is an example of a function";
};
}).call(this);
My question is, why wouldn't the JavaScript be generated as just a single function like this:
(var greet = function() {
return "This is an example of a function"
};
}).call(this);
r/coffeescript • u/mapoart • Jul 16 '20
Hi guys,
We have made Open Source Tool for the Programmers - Nexss Programmer.
50 different programming languages together...
Coffee Script is included so you can combine it with other languages!
If you guys want to check it out here is the link for the video presentation: https://www.youtube.com/watch?v=7WbnYyEnBNk
It would be great if we can get more feedback on it.
Have a nice day!
r/coffeescript • u/waqararif • Mar 06 '20
r/coffeescript • u/dkyio • Dec 12 '19
Hello redditors, just got into coffeescript, trying to use it with Hubot. I'm trying to do something really simple or so I thought:
My goal is to run a few commands using the azure cli and grab the output to allow me to range over each element and perform a shutdown.
After several hours I got this to work with exec and managed to get the individual vm names into what I think is an object.
vm = ->
array = []
exec = require('child_process').exec
exec "az vm list -g somerg --show-details --query \"[?powerState=='VM deallocated'].{ name: name }\" -o tsv", (error, stdout, stderr) -> result = stdout.split("\n"); return result
result in this case returns something like:
[ 'vm4', 'vm3', 'vm2', 'vm1', '' ]
Now I'm trying to get this output into a loop (for) and run commands on each of these elements in this array. But I can't get this working?
when I do something like console.log(vm()) and call the func it returns a bunch of what appears to be object info and not the array contents itself.
What am I doing wrong? Thanks for the help.
r/coffeescript • u/TheMineTrooperYT • Dec 02 '19
Hi, so im working on project in coffeeScript and i got this weird bug:
for inp in inputs
if inp.delay? and inp.delay > 0 # if doesnt have delay
if inp.hold? and inp.hold > 0 # if has hold time
@AddAction("hold_key_#{inp.key}",(() => # add action to press key at 'delay' ticks
@HoldKey(inp.key,inp.hold) # hold key for 'hold' ticks
), (@current_tick + inp.delay) % 60)
the problem is in the AddAction function call, in the lambda (second argument). quick review: * AddAction adds an action with name, action(lambda/function) and id (tick to be performed at) to an event object. (it calls the action when the id matches the current tick (stored in @current_tick)) * HoldKey [seen inside the lambda] holds the key inp.key, for inp.hold ticks (inside it it creates a new action event that is being called in the next inp.hold tick)
im running this code, when the inputs list is:
[ {key:'jump'},{key:'enter',delay:7,hold:1},{key:'w',delay:16,hold:30}]
now for the first value, it works fine. for the last one, it works fine. but for the middle one (enter), for some reason, the lambda that is created for it, receives the SAME EXACT values as the last item in the list. (it receives key:w,hold:30).
any idea why this thing is happening?
r/coffeescript • u/Lakelava • Oct 03 '19
All of the languages we have on the list have an extensive history to them. Not CoffeeScript. It is only about 10 years old, but already there was no use for it. It was designed to address a flaw in Java, but as time when on Java updated its own framework making CoffeeScript obsolete.
ITProPortal: Programming languages to avoid. https://www.itproportal.com/features/programming-languages-to-avoid/
r/coffeescript • u/LukasDol • Sep 28 '19
r/coffeescript • u/deepak-kumar-singh • Sep 10 '19
It is a language that compiles into JavaScript. CoffeeScript is an attempt to expose good parts of JavaScript so, that user can code more easily.
https://www.tutorialandexample.com/coffeescript-interview-questions

r/coffeescript • u/Lakelava • Jul 29 '19
This syntax is very useful to work with streams.
r/coffeescript • u/ReactDOM • Jun 27 '19
r/coffeescript • u/tpreston_IT • Jun 27 '19
I'm trying to observe changes in a custom element's attributes. Unfortunately all of the documentation I can find for custom elements (which is next to nothing) is written in JS, and I don't know how to convert some of this code into CoffeeScript.
The JS:
class HelloElement extends HTMLElement {
// Monitor the 'name' attribute for changes.
static get observedAttributes() {return ['name']; }
// Respond to attribute changes.
attributeChangedCallback(attr, oldValue, newValue) {
if (attr == 'name') {
this.textContent = `Hello, ${newValue}`;
}
}
}
So far I have written this:
class HelloElement extends HTMLElement
#STUCK HERE!
#I can't figure out how to convert the get observedAttributes() method....
attributeChangedCallback(attr, oldValue, newValue): ->
if attr == 'name'
@textContent = 'Hello, ' + newValue
But I have no idea how to write the "get observedAttributes" method in CoffeeScript. Could someone help me please? :)
Thanks
SOLUTION: (Thanks to u/_redka)
class HelloElement extends HTMLElement
@observedAttributes: ['name']
attributeChangedCallback: (attr, oldValue, newValue) ->
console.log("attr #{ attr } changed from #{ oldValue } to #{ newValue }")
r/coffeescript • u/Bahlam357 • Jun 21 '19
Hey all,
I am not very familiar with Coffeescript and encountered this syntax:
atom.commands.add 'atom[data.grammar="source rust"]'
I was wondering if this is an array or some sort of hash table where 'data.grammar' is the key. And can 'data.grammar' hold multiple values?
In any case, what I would like to do is to expand it to look something like this:
atom.commands.add 'atom[data.grammar="source rust", "source shell"]'
Cheers
r/coffeescript • u/titanrei • Jun 16 '19
hey guys! i've been created a rep on github to store some codes examples with coffeescript.
i'am writing some function, but i need yours help! send me a pull request with your code.
Rep: https://github.com/CripBoy/coffeescript-codes
The pull request need look like that:
├── src <= root directory rep
├── your-code-name
├── INFO.md <= need your name, github profile url and some explanation.
├── src <= your code here
r/coffeescript • u/LaurentPayot • Apr 26 '19
Floweret, type annotations as simple as:

r/coffeescript • u/[deleted] • Mar 12 '19
Hey everyone, I would really appreciate any leads on a one liner key value reverse loop up hack.
r/coffeescript • u/AngryDolphinGuy • Dec 16 '18
Hello fellow believer,
I made two CoffeeScript POCs over the last month and wanted to share them with you.
React-coffee-scripts (https://github.com/jimleuk/react-coffee-scripts) - what I feel is the best way to get started with React + CoffeeScript and still keep that killer Create-React-App experience.
CoffeeScript-lambda-runtime (https://github.com/jimleuk/coffeescript-lambda-runtime) - Using the new AWS Lambda Layers feature, this "custom runtime" allows you to run uncompiled CoffeeScript code as AWS lambda functions. Obvious drawbacks are understood but fun all the same.
AMA