Skip to content

Instantly share code, notes, and snippets.

View cesarpachon's full-sized avatar

cesar pachon cesarpachon

View GitHub Profile
@cesarpachon
cesarpachon / vim_commands.sh
Last active August 29, 2015 13:57
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
@cesarpachon
cesarpachon / javascript prototype chaining
Created April 14, 2014 18:00
test the concept of chaining prototypes in javascript
var A = function(){
console.log("constructor A");
//create an attribute
this.a0 = "a0";
}
//adding another attribute
A.prototype.a1 = "a1";
@cesarpachon
cesarpachon / git commands
Last active August 29, 2015 14:06
useful git commands
//-----
this one will save your life, if by mistake you delete both the remote and local branch:
git log -g
http://stackoverflow.com/questions/19592275/git-recover-branch-deleted-on-remote-and-local-folder-deleted
//-----
git checkout phase_3_main //pasarse a la rama de desarrollo activa
git up //verificar que estemos en esa rama
@cesarpachon
cesarpachon / gist:42cc9e7dd1299b17ed67
Last active August 29, 2015 14:08
LightTable setup
ctrl+space open the command list
to enable vim mode: see this readme https://github.com/LightTable/Vim#setup
ctrl+space show user behaviors add this line:
[:editor :lt.objs.editor/line-numbers]
@cesarpachon
cesarpachon / bash.sh
Last active August 29, 2015 14:10
useful bash commands
//download a whole youtube playlist as mp3 files:
youtube-dl -ix -k --audio-format mp3 YOUTUBE_PLAYLIST_URL
GREP
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.
@cesarpachon
cesarpachon / text.js
Last active August 29, 2015 14:10 — forked from refactornator/text.js
// Set up initial code for visualization
var svg = d3.select(controller.element).append("svg")
.attr("width", "100%").attr("height", "100%")
.append("g")
.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
cesarpachon / blender.py
Created April 8, 2015 13:44
blender python
# exec an external python script (http://www.blender.org/api/blender_python_api_2_59_2/info_tips_and_tricks.html)
filename = "/full/path/to/myscript.py"
exec(compile(open(filename).read(), filename, 'exec'))
@cesarpachon
cesarpachon / communicate iframe with parent via postMessage
Created May 25, 2016 15:59
communicate iframe with parent via postMessage
//in the parent:
window.addEventListener("message", function(m){console.log(m);})
//in the iframe:
window.parent.postMessage("hola", "*")