Skip to content

Instantly share code, notes, and snippets.

View pr00thmatic's full-sized avatar

Ruth García pr00thmatic

View GitHub Profile
Es una p ́
agina web en la que los estudiantes pueden explorar los archivos de
varios “casos hist ́
oricos”, luego de leer cartas, ver fotograf ́ıas, y explorar todo
tipo de “evidencias”, deber ́
an responder a varias preguntas planteadas, respecto
al contexto, sucesos y modo de vida de la ́epoca.
Las respuestas a estas preguntas no siempre ser ́an obvias, muchas veces
estar ́
an ocultas impl ́ıcitamente en detalles que podr ́ıan pasar desapercibidos por
@pr00thmatic
pr00thmatic / append-load
Created May 30, 2015 14:35
JQuery's load: append instead of replacing.
$( 'body' ).append($('<div>').load('lol.html'));
var a = (function () {
// "this" se refiere a la función instantánea anónima
this.x = 100;
var a = 1;
var showX = function () {
// el valor de "this" depende de quién
// invoque a esta función
console.log(this.x);
};
console.log(dog.nombre) // undefined
with (dog) {
try {
console.log(nombre) // error
} catch(error) {
console.log('nombre is not defined even inside the with (dog)');
}
}
var dog = (function () {
// execution context: dog's module
var nombre = "dog";
var setName = function (newName) {
nombre = newName;
};
var speak = function () {
console.log('[' + nombre + ']: woof!');
var nombre;
function setName;
function speak;
@pr00thmatic
pr00thmatic / dog-definition.js
Last active August 29, 2015 14:15
execution context in module pattern
var dog = (function () {
var nombre = "dog";
var setName = function (newName) {
nombre = newName;
};
var speak = function () {
console.log('[' + nombre + ']: woof!');
};
@pr00thmatic
pr00thmatic / js-test.js
Last active August 29, 2015 14:15
js test
var a = (function () {
this.x = 100;
var a = 1;
var showX = function () {
console.log(this.x);
};
var setX = function () {
this.x = -100;
@pr00thmatic
pr00thmatic / .emacs part
Created January 27, 2015 22:10
.emacs for global keystrokes C-c C-c comment-region and C-c C-u uncomment-region
(defun comment-marked-region ()
"comments the marked region, just like M-x comment-region"
(interactive)
(comment-region (mark) (point)))
(defun uncomment-marked-region ()
"uncoments the marked region, just like M-x uncomment-region"
(interactive)
(uncomment-region-default (mark) (point)))
var Cat = { // this is actually an object: a "prototype" object
color: 'none',
size: 'none',
meow: function() {
console.log("meow");
}
};
var Garfield = Object.create(Cat); // this is a prototype object too