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
| _.mixin | |
| # Better than random number, this should not allow for collisions. | |
| # Code was minimally modified from | |
| # [stackoverflow](http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript), | |
| # demonstrated at [jsfiddle](http://jsfiddle.net/briguy37/2MVFd/) | |
| uuid : -> | |
| now = Date.now() | |
| 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace /[xy]/g, (c) -> | |
| r = (now + Math.random() * 16) % 16 | 0 | |
| now = Math.floor now / 16 |
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
| console.json = (args...) -> | |
| console.log.apply(console, _.map(args, (a) -> JSON.stringify(a, null, ' '))) |
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
| key = "some key" | |
| key.substring(0, key.length -1) # <= Produces length is not a function Hahaha | |
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
| $("div.content").on("click", function(ev) { | |
| var s = [] | |
| var e = $(this) | |
| if (e.is(".content")) { | |
| e.find(".frame > div") | |
| .each(function(i,e) { | |
| var rgb = $(e).css("background-color") | |
| .match(/([0-9]+)/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
| public void start() { | |
| started = true; | |
| System.out.print("\u001b[31m"); | |
| System.out.print(Joiner.on(", ").join("Hello", "World")); | |
| System.out.print("\u001b[39m"); | |
| System.out.println(); | |
| } |
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
| # .tmux.conf | |
| bind | split-window -h | |
| bind - split-window -v | |
| bind r source-file ~/.tmux.conf | |
| set -g default-terminal "screen-256color" | |
| setw -g mode-mouse on | |
| set -g mouse-select-pane on |
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
| # Coffee Script | |
| # Overview | |
| # variable that is closed, var(ed) and not exposed to the global, or window | |
| # object which reduces leaking variables | |
| variable = "value" | |
| # Thin Arrow | |
| # Function one-liners |
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
| createAndMove() { mkdir $1; cd $1; } | |
| alias md="createAndMove" | |
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
| setTimeout(function() { | |
| console.log("after 2sec") | |
| }, 2000) | |
| d = new Date() | |
| while (new Date().getTime() - d.getTime() < 3000); | |
| console.log("after 3sec") |
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
| Q = require('q') | |
| fs = require('fs') | |
| _ = require("lodash") | |
| isFile = (name) -> | |
| fs.statSync(name).isFile() | |
| isDirectory = (name) -> | |
| fs.statSync(name).isDirectory() |