Skip to content

Instantly share code, notes, and snippets.

View topicus's full-sized avatar

Mariano Carballal topicus

View GitHub Profile
@topicus
topicus / gist:4611549
Created January 23, 2013 18:53
Remover acentos de un string en python
def strip_accents(s):
return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))
strip_accents(input_str.decode('utf-8'))
@topicus
topicus / gist:48fc347cd45c76ed0615
Created December 4, 2014 19:53
Explicación de this en javascript
function MiConstructor(){
scopeGlobal = 10;
var scopeLocal = 11;
var miArray = [2,10,2,3];
// apunta correctamente a MiConstructor
console.log(this);
this.mimetodo = function(){
// apunta correctamente a MiConstructor
console.log(this);
miArray.forEach(function(item){
'use strict';
function MiConstructor(){
// Guardamos la referencia a this en la variable self
var self = this;
window.scopeGlobal = 10;
var scopeLocal = 11;
var miArray = [2,10,2,3];
// Apunta correctamente a MiConstructor
console.log(self);
this.mimetodo = function(){
@topicus
topicus / gist:ce1d818e38c1ca380fbd
Last active August 29, 2015 14:11
Publishing a custom collection in meteorjs
///CLIENT///
Accounts = new Mongo.Collection('accounts');
Tracker.autorun(function () {
Meteor.subscribe('accounts-stats');
});
console.log(Accounts.find().fetch());
///END CLIENT///
///SERVER///
@topicus
topicus / gist:7d263927b9fdc67f5a45
Created December 14, 2014 00:01
Function Declarations vs Function Expressions
//function declaration
function hola(){
}
//function expresion
var hola = function(){
}
//named function expression
var hola = function hola(){
function hola(){
}
@topicus
topicus / gist:ce7e6d3a79d76feaa9f6
Created December 14, 2014 00:06
Function hoisting
console.log(hola());
function hola(){
return 'hola mundo';
}
@topicus
topicus / gist:27edcbe10fed269a5005
Created December 14, 2014 00:07
Function hosting
console.log(hola());
var hola = function(){
return 'hola mundo';
}
function hola(){
console.log('hola');
}();
!function hola(){
console.log('hola');
}();