View gist:2011138b1b2a8411d8911853603f8d52
// © 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
View MultiSelect.jsx
/**
* 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>
View es6_redux_destructure_import.js
const counter = (state=0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
View es6_destructuring_assignment.js
var a, b, rest;
[a,b] = [1,2];
console.log(a); // 1
console.log(b); // 2 // wow, so convenient! will I remember to do this, or not bother?
[a, b, ...rest] = [1, 2, 3, 4, 5];
console.log(a); // 1
console.log(b); // 2
console.log(rest); // [3, 4, 5] // incredible... although now I'm thinking this is nearly illegible for other developers
View trapezoid.css
/**
* Trapezoid tabs
*/
body {
padding: 40px;
font: 130%/2 Frutiger LT Std, sans-serif;
}
nav {
View tweetbox.jsx
var TweetBox = React.createClass({
getInitialState: function() {
return {
text: "",
photoAdded : false,
};
},
togglePhoto : function(event) {
this.setState({ photoAdded: !this.state.photoAdded })
},
View defining_lists.elm
import Text (asText)
type Collection a = Nada | Glue a (Collection a)
summm xs =
case xs of
Nada -> 0
Glue face body -> face + (summm body)
listToCollection collection =
View helpers.rb
module Sinatra
module Kittens
module Helpers
def kittens_page(x = 200..500, factor = 0.2)
sample_method = RUBY_VERSION >= '1.9' ? :sample : :choice
x = x.to_a.send(sample_method)
y = ((x - factor*x).floor..(x + factor*x).ceil).to_a.send(sample_method)
<<-HTML
<!DOCTYPE html>
View js_recursion_simple.js
function sum (numbers) {
return !numbers.length ? 0 : numbers[0] + sum(numbers.slice(1));
};
View maybe.sml
type Maybe a = Nothing | Just a
type Option a = None | Some a
type Result a = Failure | Success a
max [] ----> Failure
max [1,2,3] -----> Success 3