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
(() => { | |
const asyncForEach = (array, callback, done) => { | |
const runAndWait = i => { | |
if (i === array.length) return done(); | |
return callback(array[i], () => runAndWait(i + 1)); | |
}; | |
return runAndWait(0); | |
}; | |
const dump = {}; |
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
// FLOOR | |
var floorTexture = new THREE.ImageUtils.loadTexture( 'images/checkerboard.jpg' ); | |
floorTexture.wrapS = floorTexture.wrapT = THREE.RepeatWrapping; | |
floorTexture.repeat.set( 10, 10 ); | |
var floorMaterial = new THREE.MeshBasicMaterial( { map: floorTexture, side: THREE.DoubleSide } ); | |
var floorGeometry = new THREE.PlaneGeometry(30, 30, 0, 0); | |
var floor = new THREE.Mesh(floorGeometry, floorMaterial); | |
floor.position.y = -0.5; | |
floor.rotation.x = Math.PI / 2; | |
scene.add(floor); |
Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.
However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.
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
import React, {Component, PropTypes} from 'react'; | |
import {intlShape} from 'react-intl'; | |
import {injectIntl} from './decorator'; | |
@injectIntl() | |
class Xpto extends Component { | |
static propTypes = { | |
intl: intlShape.isRequired | |
}; |
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
-- | |
-- Name: c_posts_voted(); Type: FUNCTION; Schema: public; Owner: - | |
-- | |
CREATE FUNCTION c_posts_voted() RETURNS trigger | |
LANGUAGE plpgsql | |
AS $$ BEGIN | |
UPDATE "posts" SET voted_user_ids = array_append(voted_user_ids, NEW.user_id) WHERE "id" = NEW.post_id; | |
RETURN NEW; | |
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
# Thanks to http://dev.enekoalonso.com/2011/08/09/uninstalling-brew-so-i-can-reinstall/ | |
cd `brew --prefix` | |
rm -rf Cellar | |
brew prune | |
rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew | |
rm -rf ~/Library/Caches/Homebrew | |
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" |
WARNING : This code now lives in its own github repository: lovasoa/fast_array_intersect. It is also published on npm: fast_array_intersect
- The compressed version is only 345 caracters long.
- Faster than common libraries, even a large number of arrays, or on very big arrays. (See benchmarks)
NewerOlder