Skip to content

Instantly share code, notes, and snippets.

View vstarck's full-sized avatar

Valentin Starck vstarck

  • Argentina
View GitHub Profile
*** 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,
// ==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; }',
@joseanpg
joseanpg / Vigenere.js
Created January 14, 2013 19:53
Vigenère cipher
//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);
@cowboy
cowboy / call-invo-cursion.js
Last active March 30, 2023 01:59
JavaScript: call invo-cursion?
// 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
@jlongster
jlongster / gist:3881008
Created October 12, 2012 19:28
js destructuring macro
// 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++];) ...
}
@jasonrudolph
jasonrudolph / 00-about.md
Created September 21, 2012 18:42
Rough Notes from Strange Loop 2012
@carlosvillu
carlosvillu / gist:3762253
Created September 21, 2012 15:44
REST API

Metodos HTTP

  • 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.

Códigos de respuesta

@briancavalier
briancavalier / promise-monad-proof.js
Created August 8, 2012 15:57
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// 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
@juandopazo
juandopazo / combo.js
Created July 19, 2012 21:26
Streaming combo handler
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');
@juandopazo
juandopazo / gist:1182244
Created August 30, 2011 22:14
JavaScript without logical operators or loops
function _if(truthy, then) {
[then, function () {}][+!truthy]();
}
function ifElse(truthy, then, _else) {
[then, _else][+!truthy]();
}
function and(a, b) {
return !!((!!a + !!b) >> 1);