Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import groovy.transform.* | |
// Immutable test object | |
def tim = new Person( 'tim', new Address( 'Woo', 123 ) ) | |
// Lens for setting address for a person | |
Lens personAddress = new Lens( { p -> p.address }, { p, a -> new Person( p.name, a ) } ) | |
// And one for setting zipcode for an address | |
Lens addressZipcode = new Lens( { a -> a.zip }, { a, z -> new Address( a.street, z ) } ) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#define USE_ROBIN_HOOD_HASH 1 | |
#define USE_SEPARATE_HASH_ARRAY 1 | |
template<class Key, class Value> | |
class hash_table | |
{ | |
static const int INITIAL_SIZE = 256; | |
static const int LOAD_FACTOR_PERCENT = 90; | |
struct elem |
(aka "Algebraic JavaScript Specification")
This project specifies the behavior of a number of methods that may optionally be added to any object. The motivation behind this is to encourage greater code reuse. You can create functions that just rely on objects having implementations of the methods below, and in doing so you can make them work with a wide variety of different, but related data structures.
For the purposes of this, spec, an "entity" is an object that has an [[equivalent]]
operation (see bellow) and may implement some or all of the other methods.
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
function square(x) { | |
return x*x; | |
} | |
function add3(x) { | |
return x + 3; | |
} | |
function sub10(x) { | |
return x - 10; |
The fun part of user scripting is deciding what happens. The boring part is scavenging the DOM for bits of templated data, or elements you want to mod.
Have on.js
do it for you!
/* coffee-script example usage - at https://github.com/johan/dotjs/commits/johan | |
on path_re: ['^/([^/]+)/([^/]+)(/?.*)', 'user', 'repo', 'rest'] | |
query: true | |
dom: | |
keyboard: 'css .keyboard-shortcuts' | |
branches: 'css+ .js-filter-branches h4 a' | |
dates: 'css* .commit-group-heading' | |
tracker: 'css? #gauges-tracker[defer]' | |
johan_ci: 'xpath* //li[contains(@class,"commit")][.//a[.="johan"]]' |
macro $do { | |
case { $y:expr } => { | |
$y | |
} | |
case { $x:ident <- $y:expr $rest ... } => { | |
λ['>=']($y, function($x) { | |
return $do { $rest ... } | |
}); | |
} | |
} |
This gist was writen in 2012 and it was solving specific problem in Rails & SimpleForm. Some fellow developers were pointing out this may be out dated concept. That's why I advise everyone to read comment section bellow to have a full grasp of alternative solutions
other sources that may be helpful to understand why this may not be best idea: