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 convert_uint16_to_float32 = function(data_view, little_endian) { | |
var byte_length = data_view.byteLength | |
, result = new DataView(new ArrayBuffer(byte_length * 2)) | |
, converter = new DataView(new ArrayBuffer(2)); | |
little_endian = !! little_endian; | |
for (var i = 0, uint16, int16; i < byte_length; i += 2) { | |
uint16 = data_view.getUint16(i, little_endian); | |
converter.setInt16(0, (uint16 + 0x8000) * 0xFFFF); |
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 'optparse' | |
require 'json' | |
$options = { | |
:print_type => false, | |
:print_each => true | |
} |
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 = {} |
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($, 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
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
#!/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
(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 | |
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
<?php | |
class Nyan { | |
static public $table = array(); | |
public static function what_should_name_this_method() { | |
$args = func_get_args(); | |
$key = array_shift($args); |