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
// © 2011 Artem Sapegin http://sapegin.ru | |
// Simple CSS3 properties with vendor prefixes | |
box-sizing() | |
-moz-box-sizing arguments | |
box-sizing arguments | |
box-shadow() | |
-webkit-box-shadow arguments |
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
/** | |
* Material UI multi select | |
* | |
* Use with: | |
* <MultiSelect fullWidth={true} value={this.state.values} onChange={(e,v) => this.setState({values: v})}> | |
* <ListItem primaryText={"Option 1"} value={1} /> | |
* <ListItem primaryText={"Option 2"} value={2} /> | |
* <ListItem primaryText={"Option 3"} value={3} /> | |
* <ListItem primaryText={"Option 4"} value={4} /> | |
* </MultiSelect> |
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 Fixnum | |
def ordinal | |
%w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth][self - 1] | |
end | |
# Use #to_word rather than #to_s, so it doesn't break any other printing of numbers. | |
def to_word | |
%w[one two three four five six seven eight nine ten eleven twelve][self - 1] | |
end | |
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
(define menu | |
(lambda (x y) | |
(conde | |
[(== x 'tea) (== y 'biscuit)] | |
[(== x 'coffee) (== y 'cookie)]))) | |
(define conso | |
(lambda (x y o) | |
(== `(,x . ,y) o))) |
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
(ns hs-js-clj.core) | |
(def foo {:bar 1}) | |
(defn fooify [n] (str "foo" n)) | |
(defn commaify [[x y]] | |
(str x ", " y)) |
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
console.log("hello"); | |
function LazySeq(head, tail) { | |
this.head = head; // value | |
this.tail = tail; // thunk || null | |
} | |
function ints(n) { | |
return new LazySeq(n, function() { return ints(n+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
<!DOCTYPE html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<meta http-equiv="encoding" content="utf-8"> | |
</head> | |
<canvas id="canvas" width="1490" height="512" style="border:1px dashed"> | |
CA canvas | |
</canvas> | |
<script type="text/javascript"> | |
var canvas = document.getElementById("canvas"); |
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
def modulo_3?(number) | |
# (number % 3).zero? | |
number.modulo(3).zero? # i guess this is more idiomatic Ruby, though I like the previous better | |
end | |
def commify(number) | |
reversed = number.to_s.reverse | |
number_size = number.to_s.size | |
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
# Euclid's formula yields Pythagorean triples for integers m and n with m < n: | |
# a = m**2 - n**2 ; b = 2*m*n ; c = m**2 + n**2 | |
x = 1000 | |
def euclids upto | |
result = [] | |
(2..upto).each do |m| # Start at 2 as 1 results nothing anyway | |
(1...m).each do |n| # Euclid's formula only works for m > n | |
result << [m**2 - n**2, 2*m*n, m**2 + n**2] |
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 Array | |
def insert_every!(skip, str) | |
orig_ary_length = self.length | |
new_ary_length = orig_ary_length + ((orig_ary_length-1) / skip) | |
i = skip | |
while(i<new_ary_length) do self.insert(i,str); i+=(skip+1) end | |
self | |
end | |
end |
NewerOlder