Skip to content

Instantly share code, notes, and snippets.

View shuhei's full-sized avatar
🐢
...

Shuhei Kagawa shuhei

🐢
...
View GitHub Profile
@shuhei
shuhei / input-ie.md
Last active August 29, 2015 14:27
Directly manipulate input value and notify it to Angular
@shuhei
shuhei / wiretap.js
Created July 30, 2015 12:58
Wiretap TCP connection
var net = require('net');
var stream = require('stream');
var util = require('util');
// ANSI colors.
var green = '\u001b[32m';
var yellow = '\u001b[33m';
var reset = '\u001b[0m';
// CLI args.
@shuhei
shuhei / seven_seg.go
Last active August 29, 2015 14:22
7 segment LED
package main
import (
"github.com/stianeikeland/go-rpio"
"log"
"time"
)
func main() {
// TODO: Fix IO pins. Convert physical to gpio num.
@shuhei
shuhei / app.js
Created April 13, 2015 16:41
Browserify + Angular: separate vendor and app js
var angular = require('angular');
angular.module('myapp', [])
.controller('AppController', function ($scope) {
$scope.name = 'Browserify Angular App';
});
@shuhei
shuhei / README.md
Last active August 29, 2015 14:17
Requiring 'active_support/dependencies' changes how constant is resolved

Requiring 'active_support/dependencies' changes how constant is resolved

Without 'active_support/dependencies'

$ ruby constant_resolution.rb
inner - Hello
[Outer::Inner, Outer]
constant_resolution.rb:14:in `const_missing': uninitialized constant Outer::Inner::Hello (NameError)
	from constant_resolution.rb:19:in `'
@shuhei
shuhei / 1_before.js
Created March 26, 2015 16:21
Angular 2 type annotation with babel (babel --experimental with experimental branch)
class HelloComponent {
constructor(foo: Foo, bar: Bar) { }
}
@shuhei
shuhei / 1_before.js
Last active August 29, 2015 14:17
Angular 2 annotation with babel (babel --experimental with experimental branch)
import {Component as _Component, Template as _Template} from 'angular2/src/core/annotations/annotations';
function makeDecorator(annotationClass) {
return (options) => {
return (klass) => {
klass.annotations = klass.annotations || [];
klass.annotations.push(new annotationClass(options));
return klass;
};
};
@shuhei
shuhei / change_column_null.md
Created March 18, 2015 00:30
change_column_null

You can set not null constraint with change_column_null. You can also set default value, which is not SQL one.

@shuhei
shuhei / gist:41dd3c0b71b87e19dfe0
Created March 17, 2015 10:06
Replace all files in a git repo on OSX
git grep --name-only foo | xargs sed -i '' 's/foo/bar/g'
@shuhei
shuhei / create-patch-branch.sh
Last active August 29, 2015 14:17
Create a patch branch from a branch that is so messed up that you cannot rebase/squash.
git checkout -b working $PARENT_COMMIT_OF_YOUR_FEATURE_BRANCH
git diff working your-feature-branch | git apply
git add .
git commit
git branch -M your-feature-branch your-feature-branch-org
git branch -M working your-feature-branch
git push --force origin your-feature-branch