Skip to content

Instantly share code, notes, and snippets.

View ghiden's full-sized avatar

Hidenari Nozaki ghiden

View GitHub Profile
@ghiden
ghiden / D3-Grouping-Elements.markdown
Created September 16, 2013 09:40
A Pen by Hidenari Nozaki.
@ghiden
ghiden / D3-Grouping-Elements:-Part-2.markdown
Created September 18, 2013 09:17
A Pen by Hidenari Nozaki.

D3 Grouping Elements: Part 2

This time, sort function is cleaner than the previous one. It doesn't need to update rect and text position, just the container g. And, by using 'transform', appending rect and text becomes easier.

A Pen by Hidenari Nozaki on CodePen.

License.

bounded-zoom line chart example

Experimenting zoom behavior of d3. Zoom behavior is only active on x-axis.

A Pen by ghiden on CodePen.

License.

function ruby_version() {
echo 'ruby('`rbenv version | sed -e 's/ .*//'`')'
}
function node_version() {
echo 'node('`nvm version`')'
}
PROMPT='%{$fg[yellow]%}$(ruby_version):$(node_version) %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
$ '
@ghiden
ghiden / Venn.js-Experiment.markdown
Created August 11, 2014 09:38
A Pen by ghiden.
@ghiden
ghiden / bluebird-csv.js
Created June 15, 2015 09:07
To promisify csv-parse using Bluebird
"use strict";
var fs= require('fs');
var Promise = require('bluebird');
var parse= Promise.promisify(require('csv-parse'));
var file = fs.readFileSync('test.csv', 'utf8');
var headerKeys;
var options ={
trim: true,
#!/usr/bin/env ruby
if ARGV.length != 3
puts 'Need 3 arguments'
puts ' calculate-email-distribution INITIAL_SIZE STEP AMOUNT'
puts 'e.g.'
puts ' calculate-email-distribution 100 20 65000'
exit 0
end
@ghiden
ghiden / delay-test.js
Created June 25, 2015 19:56
Bluebird delay behaviors
var Promise = require('bluebird');
function test1() {
return new Promise(function(resolve) {
setTimeout(function() {
console.log('resolve');
resolve(100);
}, 500);
});
}
@ghiden
ghiden / test-delay.js
Created June 25, 2015 20:00
Q delay behavior
var Q = require('q');
function test() {
var d = Q.defer();
setTimeout(function() {
d.reject(new Error('failed'));
}, 500);
return d.promise;
@ghiden
ghiden / config.toml
Last active August 17, 2023 07:59
Load TOML config and pick environment from a environmental variable in Go
[dev]
url = "http://dev.example.com"
username = "dev.account"
password = "devdev"
[test]
url = "http://test.example.com"
username = "test.account"
password = "testtest"