Skip to content

Instantly share code, notes, and snippets.

View betorobson's full-sized avatar

Roberto Robson betorobson

View GitHub Profile
@cesarandreu
cesarandreu / AngularJS Provider Test Example
Last active February 6, 2018 17:59
Example of how you can test your AngularJS providers.
Look at the README.
@jakemhiller
jakemhiller / post-checkout
Created May 26, 2016 19:25
git post-checkout hook for npm installing if package.json has changed between branches
#/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"
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — 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
#/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"
}
@golimpio
golimpio / egos_throttle.sh
Last active August 23, 2023 06:54
Run cputhrottle for a list of applications in order to limit their CPU usage.
#!/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
@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
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);
@stefansundin
stefansundin / git-bundle-hook.md
Last active February 1, 2024 06:42 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

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
@sindresorhus
sindresorhus / post-merge
Last active February 14, 2024 06:20
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/`.
#!/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 February 18, 2024 10:46
Creating a Happy Git Environment on OS X

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"