Skip to content

Instantly share code, notes, and snippets.


Homam Hosseini homam

View GitHub Profile
homam / LiveScript.sublime-build
Last active Mar 31, 2019
Sublime LiveScript, Stylus, Nib Build
View LiveScript.sublime-build
"cmd": ["lsc", "-c", "$file"],
"selector" : "",
"path" : "/usr/local/bin"
View index.html
<!DOCTYPE html>
<link type="text/css" rel="stylesheet" href="radial.css" />
<body class="radial">
homam /
Last active Jan 3, 2016 — 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 Jan 27, 2014
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 Jan 27, 2014
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 Jun 24, 2014
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 Aug 29, 2015
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 Aug 29, 2015
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
You can’t perform that action at this time.