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 / 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) {
@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 / 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 / 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 / cleanup_volumes_docker.sh
Created February 5, 2016 17:52
Clean up unused volumes of docker
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-volumes
@yoelfme
yoelfme / delete_images_without_tag.sh
Created January 27, 2016 20:10
Command used for delete all images without tag (none)
docker rmi -f $(docker images | grep none | awk '{print $3}')
@yoelfme
yoelfme / avit-custom.zsh-theme
Last active January 19, 2016 17:41
This is a theme oh my zsh, forked from @avit
# AVIT ZSH Theme
PROMPT='
$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
🐑 💨 '
PROMPT2='%{$fg[grey]%}🐑 💨 %{$reset_color%} '
RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
@yoelfme
yoelfme / helpers.js
Last active January 3, 2016 22:22
Module for prevent the touchstart when scrolling
// Declare internals
var internals = {
startX: null,
startY: null,
tap: false
};
internals.setTap = function () {
internals.tap = true;
setTimeout(function () {
@yoelfme
yoelfme / docker-compose.yml
Created November 3, 2015 21:21
Elactic with Docker Compose
elasticsearch:
image: elasticsearch
command: elasticsearch -Des.network.host=_non_loopback_
ports:
- "9200:9200"
@yoelfme
yoelfme / crontab.txt
Last active September 19, 2015 01:10
Setup Crontab
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
HOME=/
MAILTO="[email protected]"
# Your crons