Skip to content

Instantly share code, notes, and snippets.

cesar pachon cesarpachon

View GitHub Profile
cesarpachon / communicate iframe with parent via postMessage
Created May 25, 2016
communicate iframe with parent via postMessage
View communicate iframe with parent via postMessage
//in the parent:
window.addEventListener("message", function(m){console.log(m);})
//in the iframe:
window.parent.postMessage("hola", "*")
# exec an external python script (
filename = "/full/path/to/"
exec(compile(open(filename).read(), filename, 'exec'))
View text.js
// Set up initial code for visualization
var svg ="svg")
.attr("width", "100%").attr("height", "100%")
.attr("transform", "translate(10,10)");
// This function receives a JS Array of JS Objects
// representing the current state of your data.
controller.update = function (data) {
// Join new data with old elements, if any.
cesarpachon /
Last active Aug 29, 2015
useful bash commands
//download a whole youtube playlist as mp3 files:
youtube-dl -ix -k --audio-format mp3 YOUTUBE_PLAYLIST_URL
simple use of grep:
grep -n search_string files //ej: grep -n main *.cpp
//list files that contains some string (only .c and .h in this example) -w forces exact word match.
grep --include=\*.{c,h} -rnw './' -e "your_search_string"
#concatenate two mp3 files.
View gist:42cc9e7dd1299b17ed67
ctrl+space open the command list
to enable vim mode: see this readme
ctrl+space show user behaviors add this line:
[:editor :lt.objs.editor/line-numbers]
cesarpachon / git commands
Last active Aug 29, 2015
useful git commands
View git commands
this one will save your life, if by mistake you delete both the remote and local branch:
git log -g
git checkout phase_3_main //pasarse a la rama de desarrollo activa
git up //verificar que estemos en esa rama
cesarpachon / javascript prototype chaining
Created Apr 14, 2014
test the concept of chaining prototypes in javascript
View javascript prototype chaining
var A = function(){
console.log("constructor A");
//create an attribute
this.a0 = "a0";
//adding another attribute
A.prototype.a1 = "a1";
cesarpachon /
Last active Aug 29, 2015
useful vim commands
:set number #enable line numbering
:set tabstop=2 #set tab size
:set nowrap #disable wrapping
#use vi mode in the shell
set -o vi #for bash
bindkey -v #for zshell
You can’t perform that action at this time.