Skip to content

Instantly share code, notes, and snippets.

@royriojas
royriojas / simple-oop.js
Created September 16, 2012 01:25
OOP in javascript
;(function($) {
'use strict';
var Nexus = function() {};
Object._extend = function(child, parent) {
var base = Nexus.prototype = parent.prototype;
child.prototype = new Nexus();
/*
This assumes you have font-awesome properly included in your page to work
*/
.font-ico-props( ) {
font-family:FontAwesome;
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
@royriojas
royriojas / why-I-love-Javascript.md
Last active September 30, 2020 13:58
Why I love Javascript

Why I love Javascript

  1. Because it has a humble origin... Designed in 10 days... was proclaimed death several times, and it was planned to be replaced by many other more "powerful" languages

  2. Because it has closures and lambdas, and the prototypal inheritance (the good parts)

  3. Because it is weird, in a very nice sense... (some bad parts... maybe?)

From the video WAT (https://www.destroyallsoftware.com/talks/wat)

http://krigan.wordpress.com/2010/10/23/el-fin-de-los-derechos-de-autor/

Los 3 derechos clásicos de autor son el de reproducción (copia), el de distribución (de ejemplares tangibles), y el de comunicación pública (que ha acabado convertido en un dar acceso). En un mundo en el que todos pueden copiar legalmente, en el que ya no hay distribución, en el que dar acceso es algo trivial, la concepción tradicional de los derechos de autor ha perdido por completo su sentido. La única opción es sustituirlos por otra cosa, la tecnología ha acabado causando el fin de los actuales derechos de autor.

@royriojas
royriojas / install.apc.sh
Last active December 14, 2016 02:29 — forked from ryanjbonnell/gist:4074061
Install apc on mac os X. Works in Mavericks!
#!/bin/bash
echo '===> install apc.so in OSX Mavericks'
mkdir -p ~/tmp/apc-deps
# Compile PCRE - Perl Compatible Regular Expressions
cd ~/tmp/apc-deps
curl -O ftp://ftp.csx.cam.ac.uk//pub/software/programming/pcre/pcre-8.33.tar.gz
tar -xvzf pcre-8.33.tar.gz
#!/bin/bash
echo "===> install memcached.so in OSX Mavericks"
HAVE_PEAR=$(which pear)
if [[ $HAVE_PEAR == "" ]] ; then
echo '===> no pear found'
echo '===> trying to install it...'
@royriojas
royriojas / vimrc
Last active January 1, 2016 06:39
vimrc
"set nocompatible
"source $VIMRUNTIME/vimrc_example.vim
"set selectmode=mouse
"set backupdir=/tmp
"set directory=/tmp
set guifont=Monaco:h13
"set guioptions-=T
"set errorfile=/tmp/rutkowsk.errors.log
"set ic
"set fileformats=dos,unix,mac
var splitArray = function (origin, chunkSize ) {
origin = origin || [];
var arr = [];
for ( var i = 0, len = origin.length; i < len; i += chunkSize ) {
arr.push( origin.slice( i, i + chunkSize ));
}
return arr;
};
@royriojas
royriojas / index.js
Last active March 27, 2016 08:25
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the right
var esformatter = require( 'esformatter' );
var esformatterJSX = require( 'esformatter-jsx' );
var throttle = require( 'lodash.throttle' );
var hash = window.location.hash.substr( 1 );
var extend = require('extend');
var params;
@royriojas
royriojas / index.js
Created February 28, 2015 10:12
requirebin sketch
var config = {
"indent": {
"value": " ",
"ArrayExpression": 1,
"AssignmentExpression": 1,
"BinaryExpression": 1,
"ConditionalExpression": 1,
"CallExpression": 1,
"CatchClause": 1,
"DoWhileStatement": 1,