Skip to content

Instantly share code, notes, and snippets.

View japboy's full-sized avatar
🏠
WFH

Yu Inao japboy

🏠
WFH
View GitHub Profile
@japboy
japboy / TODO.md
Created July 2, 2012 08:10
My snippets from JavaScript Web Applications
  • apply(), call() の理解が足りない。
[submodule "lib/normalize.css"]
path = lib/normalize.css
url = git://github.com/necolas/normalize.css.git
@japboy
japboy / Cakefile
Created July 15, 2012 03:41
jQuery demo
fs = require('fs')
{print} = require('util')
{spawn} = require('child_process')
build = (callback) ->
coffee = spawn('coffee', ['-c', '-o', './js', './js'])
jade = spawn('jade', ['-P', '-O', './', './'])
stylus = spawn('stylus', ['./css'])
coffee.stderr.on 'data', (data) ->
@japboy
japboy / Cakefile
Created July 15, 2012 09:16
Canvas demo
fs = require('fs')
{print} = require('util')
{spawn} = require('child_process')
build = (callback) ->
coffee = spawn('coffee', ['-c', '-o', './js', './js'])
jade = spawn('jade', ['-P', '-O', './', './'])
stylus = spawn('stylus', ['./css'])
coffee.stderr.on 'data', (data) ->
@japboy
japboy / Cakefile
Created July 19, 2012 17:12
My Cakefile
#
# My Cakefile
# written by [Yu Inao](http://twitter.com/japboy)
# updated on 2013-01-25
# TODO: Add YUIDoc for documentation
http = require 'http'
fs = require 'fs'
path = require 'path'
@japboy
japboy / _layout.jade
Created July 28, 2012 14:57
My skeleton Jade file
!!! 5
html(lang='ja-JP')
head
meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
block head-title
meta(name='viewport', content='width=device-width')
meta(name='author', content='Yu Inao')
meta(name='rights-standard', content='pd')
block head-meta
@japboy
japboy / web.coffee
Created August 3, 2012 06:24
My prototype apps using Node.js
#!/usr/bin/env coffee --bare
# Put `chmod +x ./web.coffee` and run `./web.coffee`
http = require 'http'
http.createServer (request, response) ->
response.writeHead 200, { 'Content-Type': 'text/plain' }
response.end 'Hello World\n'
.listen 8124
@japboy
japboy / _loader.styl
Created August 28, 2012 02:39
My skeleton Stylus file
/*!
* CSS Ajax-loader
* ===============
*
* Written by Yu Inao, distributed under Public Domain.
*
* Usage
* -----
*
* #element {
@japboy
japboy / chmod.sh
Created September 7, 2012 02:07
Useful commands that I can easily forget :P
#!/bin/sh
# Change file permission recursively
find /path/to/dir -type f | xargs chmod 644
# Or this is also same as above
find /path/to/dir -type f -exec chmod 644 {} \;
# Or change file and directory permission recursively and appropriately
# 644 for files, and 755 for directories
@japboy
japboy / array_ext_shuffle.coffee
Created September 10, 2012 06:24
Useful JavaScript snippets that I can easily forget :P
#!/usr/bin/env coffee --bare
# Extend Array to add shuffle method
Array::shuffle = ->
d = @length
while d
n1 = Math.floor(Math.random() * d)
n2 = @[--d]
@[d] = @[n1]
@[n1] = n2