Skip to content

Instantly share code, notes, and snippets.

🤓

Yoel Monzón yoelfme

🤓
View GitHub Profile
@yoelfme
yoelfme / this.js
Created Sep 23, 2016
How to function this keyword in Javascript
View this.js
/*
- 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 Jun 10, 2016
Used to upgrade version of docker client in docker machine
View update_docker_client.sh
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 Apr 6, 2016
Script used to create a simple HTTP Server with Python
View simple_server.sh
python -m SimpleHTTPServer 8888
@yoelfme
yoelfme / test-promise.js
Created Mar 15, 2016
How to make a promise with the package 'q' in Node.js
View test-promise.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 Feb 5, 2016
Clean up unused volumes of docker
View cleanup_volumes_docker.sh
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 Jan 27, 2016
Command used for delete all images without tag (none)
View delete_images_without_tag.sh
docker rmi -f $(docker images | grep none | awk '{print $3}')
@yoelfme
yoelfme / avit-custom.zsh-theme
Last active Jan 19, 2016
This is a theme oh my zsh, forked from @avit
View avit-custom.zsh-theme
# 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 Jan 3, 2016
Module for prevent the touchstart when scrolling
View helpers.js
// Declare internals
var internals = {
startX: null,
startY: null,
tap: false
};
internals.setTap = function () {
internals.tap = true;
setTimeout(function () {
@yoelfme
yoelfme / docker-compose.yml
Created Nov 3, 2015
Elactic with Docker Compose
View docker-compose.yml
elasticsearch:
image: elasticsearch
command: elasticsearch -Des.network.host=_non_loopback_
ports:
- "9200:9200"
@yoelfme
yoelfme / crontab.txt
Last active Sep 19, 2015
Setup Crontab
View crontab.txt
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
HOME=/
MAILTO="your@mail.com"
# Your crons
You can’t perform that action at this time.