Skip to content

Instantly share code, notes, and snippets.

homam / LiveScript.sublime-build
Last active March 31, 2019 13:58
Sublime LiveScript, Stylus, Nib Build
View LiveScript.sublime-build
"cmd": ["lsc", "-c", "$file"],
"selector" : "",
"path" : "/usr/local/bin"
homam / index.html
Last active December 31, 2015 07:09 — forked from jraycv/CSS3 Center Radial
View index.html
<!DOCTYPE html>
<link type="text/css" rel="stylesheet" href="radial.css" />
<body class="radial">
homam /
Last active December 1, 2020 22:45 — forked from mbostock/.block
D3 General Upadte Pattern in LiveScript

By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states.

Note that no transition is applied to the merged enter + update selection; this is because it would supersede the transition already scheduled on entering and updating elements. It's possible to schedule concurrent elements by using transition.transition or by setting, but it's simpler here to only transition the x-position on update; for entering elements, the x-position is assigned statically.

Want to read more? Try these tutorials:

This fork shows how using LiveScript improves readability of D3 enter-update-exit pattern.

homam /
Created January 27, 2014 05:47
SSH to AWS EC2 Ubunto from Cygwin
chmod 400 ~/.ssh/[key].pem
chgrp -R Users ~/.ssh/
ssh -i ~/.ssh/[key].pem ubuntu@[ip]
homam / AWS_S3_File_Upload.js
Created January 27, 2014 10:08
How to upload files to AWS S3 with NodeJS SDK
View AWS_S3_File_Upload.js
var AWS = require('aws-sdk'),
fs = require('fs');
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }
# returnA :: x -> CB x
returnA = (x) -> (callback) -> callback null, x
# bindA :: CB x -> (x -> CB y) -> CB y
bindA = (f, g) ->
(callback) ->
(err, fx) <- f!
if !!err
View Remove Duplicated
for i in ./*.jpg; do mv "$i" $(echo "$i" | sed 's/\.jpg\.jpg/\.jpg/'); done
homam / find
Created June 24, 2014 07:55
Find and grep to find a string in all files that match a pattern
View find
find . -type f -name "package.json" -exec grep -l "\"express\"\\s*:\s*\".*4" {} \;
homam /
Last active August 29, 2015 14:03
Keeping child process open in node. Instead of Ctrl+c use `process.exit 0`
fs = require \fs
_ <- fs.append-file './log.txt', "Child Started #{new Date!}\n"
<- setTimeout _ , 12000
fs.append-file './log.txt', "Child Ended #{new Date!}\n\n"
homam /
Last active August 29, 2015 14:05
Alternative to jq CLI tool using LiveScript
#!/usr/local/bin/lsc -d
# example: echo "[1,2,3,4,5]" | ./ "sum . map (+ 2)"
{each, obj-to-pairs} = require \prelude-ls
lsc = require \LiveScript
global <<< require \prelude-ls
trim = -> if it[*-1] == \; then it.substr 0, it.length - 1 else it