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
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
<!--[if lt IE 9]><script type="text/javascript" src="http://n-at.me/javascripts/ie.js"></script><![endif]--> |
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
class Hash | |
def fold!(separator = '.') | |
folder = {} | |
each do |key, value| | |
next unless key.is_a? String | |
dir = key.split separator, -1 | |
next if dir.length == 1 |
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
class NyanController < ApplicationController | |
def index | |
where = { | |
:type1 => 1, | |
:type2 => 1 | |
} | |
if params[:nyan1].is_a?(String) && /^(?:1|true|TRUE|True|T|t|yes|YES|Yes|Y|y)$/ =~ params[:nyan1] | |
where[:type1] = 2 | |
else |
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
module Nyan | |
class BaseValidator | |
def initialize(*values) | |
@values = values | |
@result = false | |
@or = false | |
@not = false | |
end |
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 ArrayDataStore extends ArrayIterator { | |
protected $separator = '.'; | |
public function set_separator($separator) { | |
$this->separator = $separator; | |
return $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
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
client_max_body_size 32m; | |
client_body_buffer_size 128k; | |
proxy_connect_timeout 90; | |
proxy_send_timeout 90; |
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
ActiveRecord::Base.connection.tables.each do |table_name| | |
next if %w|SchemaMigration Session|.include? table_name.classify | |
code = <<EOS | |
class #{table_name.classify} < ActiveRecord::Base | |
attr_accessible :#{table_name.classify.constantize.column_names.join(', :')} | |
end | |
EOS | |
`echo '#{code}' > app/models/#{table_name.singularize}.rb` |
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
body { | |
-webkit-font-smoothing: antialiased; | |
font-size: 15px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
line-height: 24px; | |
margin: 0; | |
padding: 0; | |
} | |
*:active, *:focus { outline-width: 0px; } |