Skip to content

Instantly share code, notes, and snippets.

Matt Scilipoti mattscilipoti

Block or report user

Report or block mattscilipoti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattscilipoti
mattscilipoti / gist:bd357b2413b1d0213afe95be5c4dc2a6
Created Jan 3, 2018
git: clean up local branches that have been deleted remotely
View gist:bd357b2413b1d0213afe95be5c4dc2a6
# 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
View keybase.md

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 Jun 7, 2016 — 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)
View .powenv
#!/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"
View all_factories_spec.rb
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 Apr 20, 2016
Faster Rails Load Times
View FasterRailsLoadTimes.md

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 Oct 14, 2015
JS: Compare for/each and for/in
View compare_for_loops.js
// 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);
}
View rspec_cheat_sheet.rd
INSTALL
=======
$ gem install rspec
RSPEC-RAILS
===========
RAILS-3
=======
@mattscilipoti
mattscilipoti / GeometrySpecRunner.html
Created Nov 7, 2014
Using Jasmine from jasmine-node OR html (interchangeably)
View GeometrySpecRunner.html
<!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>
View mixpanel_json_to_csv.rb
#!/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 Jan 3, 2016 — forked from pixelhandler/pre-push.sh
pre-push script: Protects some branches from destructive actions.
View pre-push.sh
#!/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.
You can’t perform that action at this time.