Skip to content

Instantly share code, notes, and snippets.

@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@martindemello
martindemello / chain-of-responsibility.rb
Created February 20, 2015 21:30
chain of responsibility example in ruby
class PurchaseApprover
# Implements the chain of responsibility pattern. Does not know anything
# about the approval process, merely whether the current handler can approve
# the request, or must pass it to a successor.
attr_reader :successor
def initialize successor
@successor = successor
end
@henrik
henrik / yosemite_upgrade_notes.md
Last active December 30, 2015 02:29
Yosemite upgrade notes

Yosemite upgrade notes

From a (mostly) Ruby on Rails developer.

After doing the below everything seems to work (some of it worked before doing anything), including Ruby, Gems, RVM, Homebrew, VirtualBox/Vagrant VMs, Pow, tmux, git, vim.

  1. Did a full-disk backup that I can restore from
  2. Moved out /usr/local to avoid super slow install, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/: sudo mv /usr/local ~/local
  3. Upgraded to Yosemite
  4. Restored /usr/local, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/: sudo mv ~/local /usr
@datagrok
datagrok / if_i_ran_the_company.md
Last active January 14, 2019 07:36
If I ran a company, what would it look like?

The article previously hosted at this location is now published on my website: If I Ran The Company.

@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y --force-yes build-essential curl git
RUN apt-get install -y --force-yes zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev
ADD http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz /tmp/ruby-2.1.0.tar.gz
RUN cd /tmp; \
tar xzf ruby-2.1.0.tar.gz; \
@nickloewen
nickloewen / bret_victor-reading_list.md
Last active March 7, 2024 18:14
Bret Victor’s Reading List

This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.


Highly recommended things!

This is my five-star list. These are my favorite things in all the world.

A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@epitron
epitron / instapaper-backup.rb
Last active October 17, 2017 02:37
An Instapaper scraper.
#!/usr/bin/env ruby
require 'mechanize'
USERNAME = ""
PASSWORD = ""
# TODO: Save cookies with "http.cookie_jar.{load,save} filename"
# TODO: Store password in ~/.config or some kind of wallet
@gbp
gbp / spec_helper.rb
Created March 14, 2014 10:43
rspec with zeus and spork
require 'rubygems'
prefork = lambda {
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
}
each_run = lambda {
...