Skip to content

Instantly share code, notes, and snippets.

View ncancelliere's full-sized avatar

Nicholas Cancelliere ncancelliere

View GitHub Profile
@ncancelliere
ncancelliere / things_tim_hates.txt
Last active August 20, 2018 21:03
Things Tim Hates
0. Not being able to get Auora, the unicorn
1. Micro-transactions to verify accounts is friction
2. Upgrading to Rails 5
3. House guests staying longer than 4 days
@ncancelliere
ncancelliere / ruby-vs-rubygem.txt
Created November 22, 2016 16:32
Ruby isn't slow - RubyGems is.
# How long does it take to execute empty string?
$ time ruby -e' '
real 0m0.346s
user 0m0.063s
sys 0m0.032s
$ time ruby --disable-gems -e' '
real 0m0.016s
user 0m0.009s
@ncancelliere
ncancelliere / gupdate.sh
Created October 8, 2015 16:07
Git Update All Repos Below CWD
# Pull updates from all git repos below your CWD. single level only
function gupdate() {
for i in */.git;
do ( cd "${i/\/.*/}"; git pull --ff-only);
done
}
$ git fetch upstream
$ git checkout omgpull
$ git rebase -i upstream/master
< choose squash for all of your commits, except the first one >
< Edit the commit message to make sense, and describe all your changes >
$ git push origin omgpull -f

Keybase proof

I hereby claim:

  • I am ncancelliere on github.
  • I am ncancelliere (https://keybase.io/ncancelliere) on keybase.
  • I have a public key whose fingerprint is 4718 46FF D958 EBD0 955B 7357 954E B9DC 94EB 8EBC

To claim this, I am signing this object:

@ncancelliere
ncancelliere / gist:935e5fa0a17834107b27
Created April 30, 2015 15:34
tagging and deploying master
git checkout master
git pull origin master
git tag $(ruby -e "puts Time.now.strftime('v%Y%m%d-%H%M')")
git push origin --tags
@ncancelliere
ncancelliere / debug_nethttp.rb
Created April 9, 2015 20:55
Debug Net::HTTP from console
module Net
class HTTP
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
ensure
@debug_output = $stderr ### if ENV['HTTP_DEBUG']
end
end
@ncancelliere
ncancelliere / prune_git_branches.sh
Created March 25, 2015 14:11
Remove local git branches that have been merged
# Credit to http://snippets.freerobby.com/post/491644841/remove-merged-branches-in-git for the script on which this is based
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
git remote prune origin
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$")
if [ -z "$local_branches" ]; then
@ncancelliere
ncancelliere / gist:fc23b4fd1c0723f37ec7
Last active August 29, 2015 14:17
A chat with TWC - cannot lower my bill.
_________Chat Transcript_____________
info: Thank you for contacting Time Warner Cable. A representative will be with you shortly.
info: You are now chatting with Raphael.
Raphael: Thank you for your calling Time Warner Cable online sales, home of the best Triple Play Offer, my name is Raphael, what services can I help you get today?
Raphael: Hi!
Nicholas: Hello - I got a question about my bill.
Raphael: What is it please?
Nicholas: On the website it says Ultimate 200 costs $60 bucks a month, but my bill is showing almost $100! Just for internet, that's crazy.
@ncancelliere
ncancelliere / gist:8d3dd76de5ee2246e399
Created March 20, 2015 12:37
Avoid JavaScript Variables Getting Hoisted
var scope = "global";
function() {
console.log(scope); // this produces undefined, not "global"
var scope = "local";
console.log(scope); // this produces "local"
}
// JavaScript doesn't use block scope, so what is actually happening is equal to below
function() {
var scope;