Skip to content

Instantly share code, notes, and snippets.


Joshua Estes JoshuaEstes

View GitHub Profile
nfedyashev /
Created Jun 13, 2013
Continuous deployment script
# Disable NewRelic pinging
curl -X POST -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
heroku maintenance:on --app yourapp-staging
heroku pg:reset DATABASE --confirm yourapp-staging --app yourapp-staging
heroku pgbackups:restore DATABASE `heroku pgbackups:url --app yourapp-production` --app yourapp-staging --confirm yourapp-staging
git remote add heroku_yourapp-staging
git push heroku_yourapp-staging $COMMIT_ID:master -f
heroku_run 'rake db:migrate' yourapp-staging
heroku restart --app yourapp-staging
heroku maintenance:off --app yourapp-staging
jubianchi / sf2_standalone_form.php
Created Aug 25, 2011
How to use Symfony2 Form Component Standalone
View sf2_standalone_form.php
namespace Standalone\Form;
use \Symfony\Component\HttpFoundation as SHttp;
use \Symfony\Component\Form as SForm;
use \Symfony\Component\DependencyInjection as SDI;
use \Symfony\Bridge as SBridge;
//Register all your autoload function here
webmozart / git-find-merge
Created Nov 15, 2012
Script to find the merge and PR a commit occurred in
View git-find-merge
if [ -z $BRANCH ]; then
perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' \
<(git rev-list --ancestry-path --oneline $COMMIT..$BRANCH) \
esmooov /
Created May 25, 2012
Carats and Tildes, Resets and Reverts

Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.

A better undo

Generally, when I push out bad code, I panic, hit git reset --hard HEAD^, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.

Enter Holman. He suggests a better default undo. git reset --soft HEAD^. Says it stag

nijikokun / example-user.js
Created May 3, 2012
Beautiful Validation... Why have I never thought of this before?!
View example-user.js
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
wbsch /
Last active Nov 20, 2019
Proof of concept for a Taskwarrior on-exit hook that manages a git repository in ~/.task
#!/usr/bin/env python
# PoC: Manage a git repository in ~/.task that gets updated on changes.
# Only and are included by default.
# You can use "git add" to add whatever files you want to track in your
# task folder.
# Inspired by
# Works with any Taskwarrior version that supports hooks.
onyxfish /
Created Feb 9, 2010
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
Base configuration
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
josephwecker /
Created Aug 11, 2012
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo:
# License: Public Domain.
# Author: Joseph Wecker, 2012
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead!
# (Thanks gioele)
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
View jquery.textchange.js
* jQuery TextChange Plugin
* Copyright 2010, ZURB
* Released under the MIT License
(function ($) {
$.event.special.textchange = {
matthewmueller /
Last active Jun 17, 2020
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
# Source:
# Some things taken from here
# Ask for the administrator password upfront
You can’t perform that action at this time.