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
| public class BoxParticle extends Particle { | |
| int color; | |
| int size; | |
| public BoxParticle(PVector location, int color, int size) { | |
| super(location); | |
| this.color = color; | |
| this.size = size; | |
| } |
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
| #!/usr/bin/env python | |
| # | |
| # Converts any integer into a base [BASE] number. I have chosen 62 | |
| # as it is meant to represent the integers using all the alphanumeric | |
| # characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
| # | |
| # I plan on using this to shorten the representation of possibly long ids, | |
| # a la url shortenters | |
| # |
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
| # Learning ruby, trying to remember these fun facts | |
| #--ARRAYS | |
| #--#--Useful functions | |
| [1, 2, 3, 4].any? {|n| n > 2} #=> true | |
| [1, 2, 3, 4].all? {|n| n > 2} #=> false | |
| #--#--collect and map (collect! and map!) | |
| a = [ "a", "b", "c", "d" ] |
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 BinaryTree | |
| attr_accessor :value, :left, :right | |
| def insert(value) | |
| if @value | |
| if value < @value | |
| @left ||= BinaryTree.new | |
| @left.insert(value) | |
| else |
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
| require 'fileutils' | |
| def deep_write(f, data) | |
| FileUtils.mkdir_p(File.dirname(f)) unless File.directory?(File.dirname(f)) | |
| File.open(f, 'w').write(data) | |
| 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Websockets tail Server</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
| <script src="/socket.io/socket.io.js"></script> | |
| <style type="text/css" rel="stylesheet"> | |
| body{background-color:#222;} | |
| #info{ font-size: 32px; color:#000;text-shadow:#444 1px 1px 2px; text-align:right;margin:20px 10px;text-transform:lowercase;} |
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
| Compiled Regex | |
| Created Default params | |
| cost_ins -> 1 | |
| cost_del -> 1 | |
| cost_subst -> 1 | |
| max_cost -> 2147483647 | |
| max_ins -> 2147483647 | |
| max_del -> 2147483647 | |
| max_subst -> 2147483647 | |
| max_err -> 2147483647 |
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
| REG_EXTENDED = 1 | |
| REG_ICASE = (REG_EXTENDED << 1) | |
| REG_NOSUB = (REG_ICASE << 1) | |
| REG_NEWLINE = (REG_NOSUB << 1) | |
| flags = [REG_EXTENDED, REG_NOSUB] | |
| p flags.reduce :| | |
| # => 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
| require 'pry' | |
| class Object | |
| LABELS = [:label1, :label2] | |
| def breakpt(label, target=self) | |
| LABELS.include?(label) ? Pry.start(target) : nil | |
| 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
| // kind of like ruby openstruct | |
| var OpenObject = function () { | |
| this.construct = function (defaults, params) { | |
| for (var attr in defaults) this[attr] = defaults[attr]; | |
| for (var attr in params) this[attr] = params[attr]; | |
| }; | |
| } | |
| var Circle = function (opts) { |
OlderNewer