Skip to content

Instantly share code, notes, and snippets.

View yoelfme's full-sized avatar
🏠
Working from home

Yoel yoelfme

🏠
Working from home
  • Guatemala
View GitHub Profile
@yoelfme
yoelfme / test-promise.js
Created March 15, 2016 19:10
How to make a promise with the package 'q' in Node.js
function myPromise() {
let deferred = Q.defer()
myRequest(options, function (err, body)) {
if (err) {
deferred.reject(err)
}
deferred.resolve(body)
@yoelfme
yoelfme / simple_server.sh
Created April 6, 2016 05:25
Script used to create a simple HTTP Server with Python
python -m SimpleHTTPServer 8888
@yoelfme
yoelfme / update_docker_client.sh
Created June 10, 2016 23:29
Used to upgrade version of docker client in docker machine
mcn_name='prod'
apt_url='https://apt.dockerproject.org'
lsb_dist='ubuntu'
dist_version='trusty'
arch=$(docker-machine ssh ${mcn_name} dpkg --print-architecture)
repo='main'
docker-machine ssh ${mcn_name} "echo deb [arch=${arch}] ${apt_url}/repo ${lsb_dist}-${dist_version} ${repo} | sudo tee /etc/apt/sources.list.d/docker.list"
docker-machine ssh ${mcn_name} sudo apt-get update
docker-machine ssh ${mcn_name} sudo apt-get install -y docker-engine
@yoelfme
yoelfme / this.js
Created September 23, 2016 07:04
How to function this keyword in Javascript
/*
- Implicit Binding
- Explicit Binding
- new Binding
- window Binding
*/
// Implicit Binding
// Left of the Dot at Call Time
var Person = function (name, age) {