Skip to content

Instantly share code, notes, and snippets.

View hsuh's full-sized avatar
🦕

Hsu Hlaing hsuh

🦕
  • Edinburgh
  • 10:34 (UTC -12:00)
View GitHub Profile
@hsuh
hsuh / gist:1749ac70846095f3af4c
Created May 12, 2014 19:14
killing a screen session
kill" will only kill one screen window. To "kill" the complete session, use quit.
Example
$ screen -X -S [session # you want to kill] quit
Notes from - http://nvie.com/posts/a-successful-git-branching-model/
The main branches
master
develop
Supporting branches
Feature branches
Release branches
Hotfix branches
@hsuh
hsuh / gist:e93f06377a2c82d12897
Last active August 29, 2015 14:01
rake db tasks
db:create creates the database for the current env
db:create:all creates the databases for all envs
db:drop drops the database for the current env
db:drop:all drops the databases for all envs
db:migrate runs migrations for the current env that have not run yet
db:migrate:up runs one specific migration
db:migrate:down rolls back one specific migration
db:migrate:status shows current migration status
db:migrate:rollback rolls back the last migration
db:forward advances the current schema version to the next one
@hsuh
hsuh / gist:d47bc8ddaaed1dbc2f38
Created May 20, 2014 14:14
angular error: Error: $parse:isecdom Referencing a DOM node in Expression
To solve this write an explicit return for your coffeescript function.
"They've only disallowed accessing DOM nodes in expressions, not in directives. Your code is only broken because of Coffeescript's bad habit of automatically returning the last value in a function's scope. Angular detects that the function has returned a DOM node and throws an exception to keep you safe. Add an explicit "return" to the end of each of those functions and they should work fine."
discussion: https://groups.google.com/forum/#!topic/angular/bsTbZ86WAY4
@hsuh
hsuh / d3cola.js
Last active August 29, 2015 14:01
Force layout constrained
var width= 960; var height = 500;
var color = d3.scale.category20();
var cola = cola.d3adaptor()
.linkDistance(120)
.avoidOverlaps(true)
.size([width,height])
var svg = d3.select("body").append("svg")
.attr("width", width)
@hsuh
hsuh / d3cola.js
Last active August 29, 2015 14:01
SVG paths
We couldn’t find that file to show.
For convenience and because dependencies may use node command instead of nodejs, a symbolic link is necessary to avoid having this error:/usr/bin/env: node: No such file or directory
Add Node symbolic link
sudo ln -s /usr/bin/nodejs /usr/bin/node
@hsuh
hsuh / gist:2aa923424907bb46a31c
Created May 28, 2014 00:38
git change config
git config --global alias.st status
@hsuh
hsuh / gist:f8a8128ad81ec50fa5d9
Created May 30, 2014 09:34
Angularjs Service vs Factory vs Provider
Services
Syntax: module.service( 'serviceName', function ); Result: When declaring serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService().
Factories
Syntax: module.factory( 'factoryName', function ); Result: When declaring factoryName as an injectable argument you will be provided with the value that is returned by invoking the function reference passed to module.factory.
Providers
@hsuh
hsuh / index.html
Last active August 29, 2015 14:02 — forked from biovisualize/index.html
A simple tooltip
<!DOCTYPE html>
<html >
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
</head>
<body>
<div class="example_div"></div>
<script type="text/javascript">
var tooltip = d3.select("body")
.append("div")