Skip to content

Instantly share code, notes, and snippets.

Roberto Robson betorobson

Block or report user

Report or block betorobson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@myshov
myshov / function_invocation.js
Last active Jul 8, 2019
11 Ways to Invoke a Function
View function_invocation.js
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@golimpio
golimpio / egos_throttle.sh
Last active Jul 1, 2019
Run cputhrottle for a list of applications in order to limit their CPU usage.
View egos_throttle.sh
#!/bin/bash
# Run cputhrottle for a list of applications in order to limit their CPU usage.
# This script needs `pidof` and `cputhrottle` installed, which can be installed from homebrew.
# NOTE: This script was tested on MacOS only.
if [[ $EUID > 0 ]]; then
echo "Please run this script as root/sudo"
exit 1
fi
@jakemhiller
jakemhiller / post-checkout
Created May 26, 2016
git post-checkout hook for npm installing if package.json has changed between branches
View post-checkout
#/usr/bin/env bash
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run npm-shrinkwrap.json "npm prune && npm install"
# check_run package.json "npm prune && npm install"
@stefansundin
stefansundin / git-bundle-hook.md
Last active Sep 4, 2019 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.
View git-bundle-hook.md

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@cesarandreu
cesarandreu / AngularJS Provider Test Example
Last active Feb 6, 2018
Example of how you can test your AngularJS providers.
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active Oct 1, 2019 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
@sindresorhus
sindresorhus / post-merge
Last active Oct 9, 2019
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@trey
trey / happy_git_on_osx.md
Last active Oct 7, 2019
Creating a Happy Git Environment on OS X
View happy_git_on_osx.md

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
You can’t perform that action at this time.