Skip to content

Instantly share code, notes, and snippets.

View alexcameron89's full-sized avatar
👋

Alex Kitchens alexcameron89

👋
View GitHub Profile
@alexcameron89
alexcameron89 / fan_aggregator.rb
Last active August 29, 2015 14:11
Cleaning fake fans from a Facebook Page.
require 'sqlite3'
require 'fb_graph'
db = SQLite3::Database.new("#{ENV['HOME']}/clientdb.db")
db.execute <<-SQL
create table fans (
username varchar(30),
name varchar(30),
location varchar(30),
@alexcameron89
alexcameron89 / benchmark_find_vs_where.rb
Created August 10, 2016 14:04
Benchmark Active Record #find(id) vs. #where(id: id)
require 'benchmark/ips'
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :projects
end
@alexcameron89
alexcameron89 / pull.sh
Last active January 24, 2017 20:18
Git Pull Bash function
# gp remembers the last commit before pulling, pulls the repository and logs
# all the commits oldest to newest along with their changes.
gp () {
# The last variable therefore stores the most recent commit's hash.
#
# What's Going on:
# git log --oneline prints a commit log on one line:
# b9bda7f Allocation free Integer#to_s
# git log -n 1 outputs only one commit, defaulting to the most recent commit.
# The log result is piped to awk which grabs the first leftmost column which
@alexcameron89
alexcameron89 / 28599.rb
Last active March 30, 2017 21:53
Bug Report for Rails Issue #28599
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
@alexcameron89
alexcameron89 / frozen_unchanged_on_save_test.rb
Created April 4, 2017 00:36
This test script shows a regression in ActiveRecord from 4-2 to 5 on frozen records that are saved.
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
@alexcameron89
alexcameron89 / 28718.rb
Last active April 11, 2017 14:00
A Reproduction Script for Rails issue #28718
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "5.0.2"
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "5.0.3"
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
name
alex
jacob
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.