Skip to content

Instantly share code, notes, and snippets.

View syntacticsugar's full-sized avatar
🎯
Focusing

RomyRomy syntacticsugar

🎯
Focusing
View GitHub Profile
@syntacticsugar
syntacticsugar / gist:2011138b1b2a8411d8911853603f8d52
Created March 7, 2017 17:02 — forked from sapegin/gist:1735915
CSS vendor prefixes for Stylus
// © 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
@syntacticsugar
syntacticsugar / MultiSelect.jsx
Created March 1, 2017 22:32 — forked from kkoch986/MultiSelect.jsx
A MultiSelect prototype for Material UI (v.0.14.4)
/**
* 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>
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
(define menu
(lambda (x y)
(conde
[(== x 'tea) (== y 'biscuit)]
[(== x 'coffee) (== y 'cookie)])))
(define conso
(lambda (x y o)
(== `(,x . ,y) o)))
(ns hs-js-clj.core)
(def foo {:bar 1})
(defn fooify [n] (str "foo" n))
(defn commaify [[x y]]
(str x ", " y))
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); });
}
<!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");
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 = ""
# 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]
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