Skip to content

Instantly share code, notes, and snippets.

View vic's full-sized avatar
🤮
puke nuke

Victor Borja vic

🤮
puke nuke
View GitHub Profile
@vic
vic / search.json
Created November 2, 2013 00:20
foo bar baz
{
"query": {
"bool": {
"must": [
{
"terms": {
"baz_id": [
6
@addyosmani
addyosmani / composition.md
Last active January 23, 2016 21:39
JS Musings

Composition

On an architectural level, the way we craft large-scale applications in JavaScript has changed in at least one fundamental way in the last four years. Once you remove the minutia of machinery bringing forth data-binding, immutable data-structures and virtual-DOM (all of which are interesting problem spaces) the one key concept that many devs seem to have organically converged on is composition. Composition is incredibly powerful, allowing us to stitch together reusable pieces of functionality to "compose" a larger application. Composition eschews in a mindset of things being good when they're modular, smaller and easier to test. Easier to reason with. Easier to distribute. Heck, just look at how well that works for Node.

Composition is one of the reasons we regularly talk about React "Components", "Ember.Component"s, Angular directives, Polymer elements and of course, straight-up Web Components. We may argue about the frameworks and libraries surrounding t

@staltz
staltz / tiny-cycle-2.js
Created December 10, 2015 19:46
Tiny Cycle.js 2
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => {
return {
tagName: 'h1',
children: [`Seconds elapsed ${i}`]
}
})
}
const getAllPropertyNames = require('./get_all_property_names'),
Mutex = require('./mutex')
function actor(object) {
let methods = getAllPropertyNames(object),
mutex = new Mutex(),
wrapper = {}
for (let method of methods) {
if (typeof object[method] !== 'function') continue
@SeonghoonKim
SeonghoonKim / elasticsearch-bootstrap.sh
Created December 26, 2012 09:31
elasticsearch install script
#!/bin/bash
INSTALL_ROOT="/opt"
echo "Installing ElasticSearch..."
cd $INSTALL_ROOT
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.1.tar.gz | tar -xz
ln -s elasticsearch-0.20.1/ elasticsearch
echo "Installing ElasticSearch service wrapper..."
@trueadm
trueadm / gist:680dad38e910c47c4b7126d17771ad2a
Created June 16, 2016 11:53
Chrome 53 Canary + Hardware performance flag
Enter this into your terminal (Mac users), ensure you have Chrome Canary in your Applications directory:
Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-main-frame-before-activation
@davoclavo
davoclavo / vine_hasher.rb
Last active October 15, 2016 20:56
tool to unhash/hash vine ids
module VineHasher
VINE_KEY = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll'
VINE_KEY_SIZE = VINE_KEY.size
VINE_KEY_HASH = VINE_KEY.split('').each_with_index.inject({}) {|hash, (key, index)| hash[key] = index; hash }
def unhash_id(hashed_id)
hashed_id.reverse.split('').each_with_index.inject(0) { |total, (key, index)| total + VINE_KEY_HASH[key] * VINE_KEY_SIZE**index }
end
def hash_id(id)
anonymous
anonymous / gist:634b938ac2702db4991a98c4ce6c5ccc
Created November 21, 2016 07:04
solo un par de palabras, indecibles.
¿cómo he de hacerte sentir?
¿cómo hacerte entenderlo?
Sin que se adueñen de ti
con su rostro de espanto
la parálisis el miedo.
Las palabras que fermentan
lo que digo lo que siento
incapaz de retenerlas
OPTIONAL MATCH path = (x)<-[*..3]-() WHERE ID(x) = 65
WITH apoc.coll.toSet([n in nodes(path) WHERE n is not null
| { id: id(n),label: labels(n),type:"",metadata: properties(n) } ]) as nodes,
apoc.coll.toSet([r in relationships(path) WHERE r is not null
| { id: id(r),source: id(startNode(r)),relation: type(r),target: id(endNode(r)), directed: "true" } ]) as rels
RETURN { graph: { type:"",label: "",directed: "true",nodes: nodes,edges: rels,
metadata:{ countNodes: size(nodes),countEdges: size(rels) } } } as graph;
module Cycle where
import Almost (Stream, Promise, observe, Subject, holdSubject, next, complete, thenp)
import Data.StrMap (fromFoldable, StrMap, keys)
import Data.StrMap.Unsafe (unsafeIndex)
import Data.Tuple (Tuple(..))
import Prelude (map)
type Drivers a b = StrMap (Subject a -> b)
type Sinks a = StrMap (Stream a)