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
// A response to jashkenas's fine proposal for minimalist JavaScript classes. | |
// Harmony always stipulated classes as sugar, so indeed we are keeping current | |
// JavaScript prototype semantics, and classes would only add a syntactic form | |
// that can desugar to ES5. This is mostly the same assumption that Jeremy | |
// chose, but I've stipulated ES5 and used a few accepted ES.next extensions. | |
// Where I part company is on reusing the object literal. It is not the syntax | |
// most classy programmers expect, coming from other languages. It has annoying | |
// and alien overhead, namely colons and commas. For JS community members who |
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
~~~~~~~~~~~~~~~~~~~~ | |
a one-line code block | |
~~~~~~~~~~~~~~~~~~~~ | |
~~~~{lang} | |
codeFromLang(); | |
~~~~ | |
~~~~{python} | |
var hello = 'world' |
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
(ns tryme.core) | |
(defn run-test | |
"Given a test sequence, runs the test and returns a result object" | |
[[name function input expected]] | |
(try | |
(let [actual (apply function input)] | |
(if (= expected actual) | |
{:type :success :name name} | |
{:type :failure :name name :expected expected :actual actual})) |
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
_.templateSettings = { | |
evaluate : /\{\%([\s\S]+?)\%\}/g, // {% eval(js); %} | |
interpolate : /\{\{([\s\S]+?)\}\}/g // {{ interpolate }} | |
}; |
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
#!/usr/bin/env dart | |
#import('dart:isolate'); | |
isolateCode() { | |
isolate.port.receive((msg, reply) => reply.send("re: $msg")); | |
} | |
void main() { | |
isolate.SendPort sendPort = isolate.spawnFunction(isolateCode); |
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.setupFilterInput = function (events) { | |
var $input = $(this), | |
handlers = { | |
// use these to provide default but overwriteable functionality | |
focus: function () {}, | |
blur: function () {}, | |
keyUp: function () {}, | |
click: function () {} | |
}, | |
middleware = { |
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
var add = function(a, b) { | |
return a + b; | |
}; | |
add(20, 30); // 50 | |
// Twenty is so special for our use case that we want it to always be included | |
var addTwenty = _.bind(add, {}, 20); | |
//fn, this, args... | |
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
render: function(){ | |
this.collection.each(console.log); | |
}, |
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
#!/bin/sh | |
# invoke like: ./bootstrap <somehost> -u <someuser> | |
# all invocation time flags will be forwarded to ansible | |
# don't specify module or args | |
# pulls down simplejson to $HOME/.ansible/deps | |
# creates a new ansible_python_interpreter located at $HOME/.ansible/bin/python usable by anyone on the box | |
ansible -m raw $@ -a 'mkdir -p $HOME/.ansible/deps && \ | |
curl http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.0.tar.gz | \ |
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
#!/usr/bin/env python | |
import pexpect | |
import sys | |
PASS_PARAM = "-p" | |
def usage(): | |
print "./promptless_playbook %s <PASSWORD> <PLAYBOOK_ARGS...>" % PASS_PARAM | |
print "example: ./promptless_playbook playbooks/myplaybook.yml -p Hax0r32 -u coolguy -u sudo_role -e 'foo=bar'" |
OlderNewer