This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controllerSample.js | |
module.exports = function($) { | |
return require('../slave.js')($, function($) { | |
/* If you need to add mixins or properties to the objects | |
that are given from master.js, you need to declare those | |
inside of this function. Otherwise, they will not work. */ | |
_.mixin({ | |
compactObject: function(to_clean) { | |
$._.map(to_clean, function(value, key, to_clean) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# socket.coffee | |
module.exports = (soc) -> | |
debug = true | |
# router | |
soc.routes = [] | |
soc.mount = (action, next = ->) -> | |
soc.routes.push [action, next] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This gist aims to demonstrate how sets can | |
be compared in Seth. | |
All set-to-set comparison methods begin with | |
`is` such as `#isSuperset()`. And these methods | |
return a Proof class instance with useful | |
assertion methods. | |
Comparisons must be proved through assertions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example: Extended EMF Actor Class | |
This is not in the core package because | |
(1) it is trivial to implement and everyone should | |
be using their own base classes, and | |
(2) it sets a couple bad presidences mainly that | |
(a) methods and actions are 1:1 and | |
(b) calls to Actor should only have one arg, and | |
(3) makes debugging and type-checking tough as functions | |
are created at runtime. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var days = [ | |
"Sunday", | |
"Monday", | |
"Tuesday", | |
"Wednesday", | |
"Thursday", | |
"Friday", | |
"Saturday" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.extend({ | |
setClass: function(name, add) { | |
if(typeof name === 'object') { | |
const classes = name; | |
Object.keys(classes).forEach(className => { | |
this.setClass(className, classes[className]); | |
}); | |
} else { | |
this.each((index, elem) => { | |
if(add) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DeCoffeeScript script | |
if [[ -z "$1" ]] ; then | |
echo 'decaf error: pass a basename' | |
exit 1 | |
fi | |
coffee_file=$1.coffee | |
js_file=$1.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Defer.js | |
Usage: | |
const myDefer = new Defer() | |
myDefer.then(x => assert.equal(x, 1)) | |
myDefer.resolve(1) | |
*/ | |
export default class Defer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeEmptyNodes (nodes) { | |
return nodes.filter(node => { | |
if (node.type === 'element') { | |
node.children = removeEmptyNodes(node.children); | |
return true | |
} | |
return node.content.length | |
}) | |
} |
OlderNewer