Skip to content

Instantly share code, notes, and snippets.

@htulipe
htulipe / cordova-device-ready.js
Last active September 12, 2018 17:15
Wait for Phonegap's deviceready event before initializing an Ember application
import isOnCordova from '../utils/is-on-cordova';
export function initialize(container, application) {
application.deferReadiness();
document.addEventListener('deviceready', function() {
application.advanceReadiness();
}, false);
if(!isOnCordova()){
document.dispatchEvent(new Event('deviceready'));
}
@htulipe
htulipe / gist:ba250e1c9231fad05e2a
Last active July 11, 2019 11:58 — forked from nikreiman/gist:5458386
Clean up local branches that are already on master (credit to original gist)
function git-branch-current() {
printf "%s\n" $(git branch 2> /dev/null | grep -e ^* | tr -d "\* ")
}
function git-branch-cleanup() {
local currentBranch=$(git-branch-current)
local otherBranch=
for otherBranch in $(git branch | grep -v $currentBranch) ; do
printf "Branch %s:\n" "$otherBranch"
printf " HEAD commit is: %s\n" "$(git log --oneline -n 1 $otherBranch)"