This gist is a collection of my rough notes from Strange Loop 2012.
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
*** AVISO, si lees ésto podrías llegar a desaprender *** | |
Cuidado con las mónadas, yo estoy bastante seguro de no entenderlas (bien). | |
Me explico, el concepto "por definición" de mónada es bastante simple, | |
bastante confuso al principio (como todo, supongo) pero luego es simple | |
(simple en el sentido de que las reglas que se aplican son sencillas, | |
luego cada mónada ya... puede ser infumable de entender). | |
(Ojo, lo que sigue hasta el siguiente aviso es una explicación CONCEPTUAL, |
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
// ==UserScript== | |
// @name Colorful Teg | |
// @version 1.0 | |
// @match *teg.avature.net* | |
// @run-at document-end | |
// ==/UserScript== | |
[ | |
'.analysis_functional > td {background-color: rgba(255, 80, 168, 0.45) !important; }', | |
'.testing > td { background-color: rgba(255, 255, 176, 0.45) !important; }', |
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
//http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher | |
//https://twitter.com/r0aTzdg73QLawWw/status/290907958118842368 | |
//https://gist.github.com/1385585 | |
var vigenere = (function() { | |
var map = Array.prototype.map; | |
var canon = function(str){ return map.call(str.toUpperCase(),function(c){return c.charCodeAt(0)-65})} | |
return function(source, key) { | |
source = canon(source); | |
key = canon(key); |
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
// OOP | |
console.log( 'OHAI'.blink() ); | |
// Call invocation | |
console.log( String.prototype.blink.call('OHAI') ); | |
// $ always makes things look awesome. | |
var $ = Function.prototype.call; | |
// Very explicit call invocation |
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
// Note: there are bugs in hygienic renaming, so this doesn't work all the time yet. | |
macro varr { | |
case [$var (,) ...] = $expr => { | |
var i = 0; | |
var arr = $expr; | |
$(var $var = arr[i++];) ... | |
} |
- GET: No altera los datos en el servidor, solo puedes obtener datos de el
- POST: Crea datos en el server
- PUT: Altera datos en el server
- DELETE: Lo borra de forma permanente
También puedes usar POST para hacer llamadas a métodos asíncronos, estos son aquellos que deben de realizar alguna operación que va a requerir más de un tiempo razonable de respuesta ( 100ms en el server ). Si usas POST no deberías de agregar variables GET en la URL.
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
//------------------------------------------------------------- | |
// | |
// Hypothesis: | |
// | |
// Promises/A is a Monad | |
// | |
// To be a Monad, it must provide at least: | |
// - A unit (aka return or mreturn) operation that creates a corresponding | |
// monadic value from a non-monadic value. | |
// - A bind operation that applies a function to a monadic value |
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
var fs = require('fs'), | |
Stream = require('stream'), | |
util = require('util'); | |
function ComboStream(files, opts) { | |
Stream.call(this); | |
opts = opts || {}; | |
if (!Array.isArray(files)) { | |
throw new TypeError('First argument must be an Array'); |
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
function _if(truthy, then) { | |
[then, function () {}][+!truthy](); | |
} | |
function ifElse(truthy, then, _else) { | |
[then, _else][+!truthy](); | |
} | |
function and(a, b) { | |
return !!((!!a + !!b) >> 1); |
NewerOlder