This file contains hidden or 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
jQuery.fn.quickEach = (function() { | |
var jq = jQuery([1]); | |
return function(c) { | |
var i = -1, el, len = this.length; | |
try { | |
while (++i < len && (el = jq[0] = this[i]) && c.call(jq, i, el) !== false); | |
} catch (e) { | |
delete jq[0]; | |
throw e; | |
} |
This file contains hidden or 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
public class Complex { | |
private Complex() {} | |
public static void main(String[] args) { | |
new ComplexBuilder() | |
.setFirst("first") | |
.setSecond("second") | |
.setThird( "third" ) | |
.build(); |
This file contains hidden or 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
(global-set-key (kbd "C-c C-r") 'run-mocha) | |
(defun run-mocha() | |
"Runs all the tests in the current buffer" | |
(interactive) | |
(let* (command result exit-value) | |
(setq command (concat "mocha -r should " (buffer-name))) | |
(setq exit-value (shell-command command)) | |
(color-modeline exit-value))) |
This file contains hidden or 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
request({ | |
method: "POST", | |
uri: "http://example.com/action", | |
json: { | |
foo: "foo", | |
bar: "bar" | |
} | |
}, function (error, response, body) { | |
if(response.statusCode === 201){ | |
console.log("posted"); |
This file contains hidden or 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
//I've launched my app as so: NODE_ENV=development nodemon server.js | |
var Log = new require("log"), | |
log = new Log(process.env.NODE_ENV === "production" && | |
"error" || "debug"); |
This file contains hidden or 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
(defun mocha-run(test-file) | |
"Runs all the tests in the passed file" | |
(interactive "b") | |
(let* (command result exit-value) | |
(setq command (concat "mocha -r should --globals i --timeout 10000 " test-file)) | |
(setq exit-value (shell-command command)) | |
(color-modeline test-file))) | |
(defun color-modeline(test-file) | |
"Colors the modeline, green success red failure" | |
(interactive) |
This file contains hidden or 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(){ | |
return typeof arguments; | |
})(); |
This file contains hidden or 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 f = function g(){ return 23; }; | |
typeof g(); |
This file contains hidden or 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(x){ | |
delete x; | |
return x; | |
})(1); |
This file contains hidden or 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 y = 1, x = y = typeof x; | |
x; |