This file contains hidden or 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
| make angle divide [ arcsine divide [ 3 5 ] degree ] | |
| command square [ size ] [ | |
| repeat 4 [ forward size left 90 ] | |
| ] | |
| command subdivide [ ratio size ] [ | |
| multiply [ ratio divide [ size 5 ] ] | |
| ] |
This file contains hidden or 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 Pixel | |
| attr_reader :pointer | |
| Minimum = 0.00 | |
| Maximum = 1.00 | |
| Margin = 0.15 | |
| Vertices = [ | |
| # 4-point triangle fan |
This file contains hidden or 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
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000 |
This file contains hidden or 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
| # Starting with this array, how many different ways can you create two arrays of every other element | |
| array = %w(key_a value_a key_b value_b key_c value_c) | |
| # 1 | |
| hash = Hash[*array] | |
| hash.keys | |
| hash.values | |
| # 2 | |
| Hash[*array].to_a.transpose |
This file contains hidden or 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 array, item, _i, _len; | |
| array = []; | |
| for (_i = 0, _len = items.length; _i < _len; _i++) { | |
| item = items[_i]; | |
| doAsyncRequest(item, function(result) { | |
| array << result; | |
| if ((_i + 1) === _len) { | |
| return callback(array); |
This file contains hidden or 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 Person | |
| def speak | |
| puts "My name is #{@name}. I am a #{@occupation}." | |
| end | |
| def occupation(occupation) | |
| @occupation = occupation | |
| end |
This file contains hidden or 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
| // SomethingAwful Emote Support (http://sae.tweek.us/) | |
| var mapping = {}; | |
| var loadEmotes = function(response) { | |
| response.forEach(function(a){a.emoticons.forEach(function(b){mapping[b.code] = b.image})}); | |
| window.chat.speaker.filters.unshift( | |
| function(m){ | |
| var match; | |
| if(match=m.match(/^:(.*):$/)){ |
This file contains hidden or 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
| ; Convert numbers to english words. | |
| (defn | |
| single | |
| [n] | |
| (nth | |
| '(one two three four five six seven eight nine) |
This file contains hidden or 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 to_class(name, namespace='Object') | |
| hash = self | |
| namespace = Kernel.const_get namespace.capitalize | |
| name = name.capitalize | |
| namespace.const_get(name).new hash | |
| rescue Exception => err | |
| namespace.const_set(name, Class.new do | |
| attr_accessor *hash.keys | |
| def valid?() true end |
NewerOlder