Skip to content

Instantly share code, notes, and snippets.

View mattscilipoti's full-sized avatar

Matt Scilipoti mattscilipoti

View GitHub Profile
@mattscilipoti
mattscilipoti / gist:bd357b2413b1d0213afe95be5c4dc2a6
Created January 3, 2018 16:16
git: clean up local branches that have been deleted remotely
# 1. saves possible branches to file, opens in editor
# 2. remove branches you don't want to delete from the list and save.
git fetch --prune && git branch --no-color --merged | egrep -v "(^\*|master)" > /tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d < /tmp/merged-branches

Keybase proof

I hereby claim:

  • I am mattscilipoti on github.
  • I am mattscilipoti (https://keybase.io/mattscilipoti) on keybase.
  • I have a public key whose fingerprint is DFD4 1E67 9A6B C312 AA9F 2912 546F C3BA 8673 E21A

To claim this, I am signing this object:

@mattscilipoti
mattscilipoti / .powenv
Last active January 18, 2021 22:09 — forked from flarik/dot.powrc.sh
Pow's .powenv config file for use with RVM's config files .rvmrc or .ruby-version (+ optional .ruby-gemset)
#!/usr/bin/env bash
if [ -f "${rvm_path}/scripts/rvm" ]; then
source "${rvm_path}/scripts/rvm"
# use the config files
# .rvmrc supersedes all others
if [ -f ".rvmrc" ]; then
source ".rvmrc"
require 'spec_helper'
RSpec.describe FactoryGirl do
# convention: "base" factories return valid models.
# without these tests, factories with invalid associations are difficult to identify and debug
# Note: performs build, not create.
describe 'all factories,' do
factories_to_skip = {}
@mattscilipoti
mattscilipoti / FasterRailsLoadTimes.md
Last active April 20, 2016 15:19
Faster Rails Load Times

Faster load times? (circa 2011)

  • Benchmark with:

        $ time script/rails runner "puts 1"
  • Dropped from 18 to 13s using :require => false judiciously in Gemfile.

  • (outdated with ruby 2.3, I think) Dropped from 13 to 8.5s using patched ruby:

@mattscilipoti
mattscilipoti / compare_for_loops.js
Last active October 14, 2015 16:38
JS: Compare for/each and for/in
// console.log("test");
var names = ["matt", "adam"];
// 1: use for/in, w/var
console.log("Starting 1 (for/in)...")
var idx = -9;
console.log("idx: before1", idx)
for (var idx in names) {
console.log("idx: in1", idx);
}
@mattscilipoti
mattscilipoti / rspec_cheat_sheet.rd
Last active August 29, 2015 14:26 — forked from byplayer/rspec_cheat_sheet.rd
rspec cheat sheet
INSTALL
=======
$ gem install rspec
RSPEC-RAILS
===========
RAILS-3
=======
@mattscilipoti
mattscilipoti / GeometrySpecRunner.html
Created November 7, 2014 17:09
Using Jasmine from jasmine-node OR html (interchangeably)
<!DOCTYPE html>
<html>
<head>
<title>geometry specs</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/boot.js"></script>
#!/usr/bin/env ruby
# Used to convert json from MixPanel into csv
# see: https://stackoverflow.com/questions/7845015/convert-json-to-csv-in-ruby
# and: https://stackoverflow.com/questions/273262/best-practices-with-stdin-in-ruby
class MixPanelJsonToCsv
require 'csv'
require 'optparse'
attr_reader :config
@mattscilipoti
mattscilipoti / pre-push.sh
Last active January 3, 2016 06:39 — forked from pixelhandler/pre-push.sh
pre-push script: Protects some branches from destructive actions.
#!/usr/bin/env ruby
# NOTE! this is a work in progress. This is not tested or used regularly.
# Ensures we do not call destructive commands on protected branches.
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.