This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
jquery_version="1.9.1" | |
jquery_name="jquery-${jquery_version}.min.js" | |
jquery_url="http://code.jquery.com/$jquery_name" | |
mkdir -p haml coffee sass vendor public/{javascripts,stylesheets,images,lib} | |
touch vendor/.gitkeep | |
curl -L "$jquery_url" > "public/lib/$jquery_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Nyan { | |
static public function static_method_nyan() { | |
echo 'static nyan', "\n"; | |
} | |
static public function __callStatic($name, $args) { | |
$method_name = 'static_method_' . $name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Nyan { | |
static public $table = array(); | |
public static function what_should_name_this_method() { | |
$args = func_get_args(); | |
$key = array_shift($args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'webrick' | |
server = WEBrick::HTTPServer.new( | |
:DocumentRoot => '.', | |
:Port => (ARGV[0] || '3001').to_i, | |
:MimeTypes => WEBrick::HTTPUtils::DefaultMimeTypes.merge({ | |
'js' => 'application/javascript' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$(document).on('mousedown', function mousedown_handler(e) { | |
var mousemove_handler = function(e) { | |
// 動かしたり | |
}; | |
$(this) | |
.on('mousemove', mousemove_handler) | |
.on('mouseup', function mouseup_handler(e) { | |
$(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
begin | |
page = ARGV[0].to_i | |
raise 'invalid arguments' if page <= 0 || page % 4 != 0 | |
column_width = 5 | |
row_width = 17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "digest/md5" | |
d = Digest::MD5.hexdigest("nyan" + Time.now.strftime("%Y%m%d")).to_i(16); | |
shindan = [] | |
10.times {|n| shindan[n] = []; 99.times {|nn| shindan[n] << nn.to_s } } | |
result = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function($, start_x, start_y, target_start_x, target_start_y, $target) { | |
$(document).on('mousedown', function(e){ | |
var style, target = e.target; | |
do { | |
style = document.defaultView.getComputedStyle(target, null); | |
} while (style.position !== 'absolute' && (target = target.parentNode)); | |
if (!target)return; | |
$target = $(target); | |
var position = $target.position(); | |
start_x = e.pageX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Step = function(steps) { | |
if (this instanceof Step) { | |
this.items = []; | |
this.oncomplete = null; | |
this.onabort = null; | |
if (steps) { | |
for (var i = 0, j = steps.length; i < j; i ++) | |
this.add(steps[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(d) { | |
var script = d.createElement('script'); | |
script.textContent = '(' + function(d, l) { | |
var href = l.href | |
, hash_index = href.indexOf('#') | |
, query_index = href.indexOf('?') | |
, hash = hash_index < 0 ? '' : href.substring(hash_index + 1) | |
, query = query_index < 0 ? '' : href.substring(query_index + 1, hash_index < 0 ? href.length : hash_index) | |
, params = {} |