Skip to content

Instantly share code, notes, and snippets.

View hnakamur's full-sized avatar

Hiroaki Nakamura hnakamur

View GitHub Profile
@hnakamur
hnakamur / gist:9428153
Created March 8, 2014 09:59
bashスクリプトをシェルから実行するときの引数のエスケープ
$ cat echo_arg.sh
#!/bin/bash
echo arg=$1
$ ./echo_arg.sh "$6$"
arg=$
$ ./echo_arg.sh '$6$'
arg=$6$
@hnakamur
hnakamur / setup.sh
Created April 26, 2014 11:56
(WIP) my mavericks setup script
xcode-select --install
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@hnakamur
hnakamur / index.html
Created July 26, 2014 03:22
SVG path getTotalLength() in Firefox returns 0 or a wrong large value for some cubic bezier segments. try http://bl.ocks.org/hnakamur/f203e1cb6adedb56eca8
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div id='example'>
<svg width="300" height="300">
<path id="path1" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" stroke="black" fill="none"/>
<path id="path2" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/>
</svg>
@hnakamur
hnakamur / index.html
Last active August 29, 2015 14:04
Firefox hangs with SVG path getTotalLength for some path with two cubic bezier segments. try http://bl.ocks.org/hnakamur/bc26a6fa7d7b8d9dc795
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div id='example'>
<svg width="300" height="300">
<path id="path1" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" stroke="black" fill="none"/>
<path id="path2" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/>
<path id="path3" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/>
@hnakamur
hnakamur / bezier-curve.js
Created July 31, 2014 13:30
offseted marker on cubic bezier curve example
(function(root) {
function BezierCurve(points) {
this.xs = points.map(function(point) { return point.x; });
this.ys = points.map(function(point) { return point.y; });
}
// LUT for binomial coefficient arrays per curve order 'n'
var binomialCoefficients = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]];
@hnakamur
hnakamur / README.md
Last active August 29, 2015 14:05
bezier curve intersections
@hnakamur
hnakamur / localhost.yml
Last active August 29, 2015 14:05
Ansible localhost playbook for my MacBook
- hosts: localhost
connection: local
gather_facts: yes
sudo: no
roles:
- hnakamur.osx-defaults
- hnakamur.homebrew-packages
- hnakamur.homebrew-cask-packages
- hnakamur.osx-login-shell
- hnakamur.oh-my-zsh
@hnakamur
hnakamur / README.md
Last active August 29, 2015 14:06
An example for drawing an arrowhead at the intersection of a bezier curve and a circle using d3.js
@hnakamur
hnakamur / spawn_ls_promise.lua
Created September 6, 2014 07:50
An example using uv.spawn with lua_promise
-- An example using uv.spawn with Promise.
-- (c) 2014 Hiroaki Nakamura
-- MIT license
--
-- Used libraries
-- * luv: https://github.com/luvit/luv
-- * lua_promise: https://github.com/friesencr/lua_promise
local uv = require("luv")
require("Promise")
@hnakamur
hnakamur / spawn_ls_exit_code.lua
Last active August 29, 2015 14:06
an example luvit/luv spawn a process and connect stdout to stdout or file
local uv = require("luv")
local options = {
stdio = {
nil,
1,
nil
}
}