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
# this gist teaches you how to balance colors using HEX-to-DEC conversions. | |
# In color theory, additive colors are colors that, when combined, produce solid white. | |
# HEX primaries, plus black and white | |
# remember, HEX colors desribe the state of a color channel. think of 00 as "OFF" and FF as "ON". | |
@red = "FF0000" # red channel fully ON, all else fully OFF | |
@green = "00FF00" # green channel fully ON, all else fully OFF | |
@blue = "0000FF" # blue channel fully ON, all else fully OFF | |
@black = "000000" # all channels fully OFF |
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 DataSet < Array | |
def input(data) | |
if data.kind_of?(Enumerable) | |
data.each do |item| | |
if item.kind_of?(Numeric) == true | |
self << item | |
else | |
self.input(item) | |
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
require 'rspec' | |
require './../core_arithmetic' | |
class DataSet < Array | |
def input(data) | |
if data.kind_of?(Enumerable) | |
data.each do |item| | |
if item.kind_of?(Numeric) == true | |
self << item |
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
@for $i from 1 through 4 { | |
.span#{$i} { | |
margin:0; | |
padding:0; | |
float:left; | |
@media (min-width:960px) { | |
width: percentage(1/$i); | |
} | |
@media (max-width:780px) and (max-width:959px) { |
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
# finally, correctly rewrote the Python script "survey" in Think Stats to Ruby. | |
# burned the midnight candle to get this right. feels great to succeed | |
class Table < Hash | |
def initialize(name=nil) | |
self[:records] = [] | |
self[:name] = name | |
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
# port of David Dalrymple's GNU C code | |
# the original C code can be found at http://davidad.net/colorviz/ | |
def lab_to_xyz(lab) | |
l = lab[0] | |
a = lab[1] | |
b = lab[2] | |
ill = [0.9643, 1.0, 0.8251] |
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 'chingu' | |
class Player < Chingu::GameObject | |
def initialize | |
super | |
self.x, self.y = 200, 200 | |
self.image = Gosu::Image["ship1.jpg"] | |
self.input = { | |
:holding_left => :move_left, | |
:holding_right => :move_right } |
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
(ns my.namespace.core) | |
(if true 1) | |
(gensym) | |
(defn my-when [pred & body] | |
(let [x# pred] | |
`(if ~x# (do ~@body (println "done"))))) |
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
get '/webwork' do | |
haml :webwork | |
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
article h1, article p { | |
padding: 18px; } | |
article h1 { | |
font-size: 200%; } | |
article blockquote { | |
width: 80%; | |
margin: auto; } | |
article img { | |
margin: auto; } | |
.articles article { |