Skip to content

Instantly share code, notes, and snippets.

View zach-taylor's full-sized avatar

Zach Taylor zach-taylor

View GitHub Profile

Keybase proof

I hereby claim:

  • I am zach-taylor on github.
  • I am ztaylor (https://keybase.io/ztaylor) on keybase.
  • I have a public key whose fingerprint is 88F5 1B8B 34E4 2870 25A5 E14A BAB5 DE6A 6BC3 AA7D

To claim this, I am signing this object:

@zach-taylor
zach-taylor / update_query_param.js
Created October 24, 2016 18:02
function to add or update a query parameter
var updateQueryParam = function(query_param, new_value) {
var re = new RegExp('(' + query_param + '=)[^\\&]*');
if (re.test(location.href)) {
location.href = location.href.replace(re, '$1' + new_value);
} else {
location.href = location.href + '?' + query_param + '=' + new_value;
}
};
@zach-taylor
zach-taylor / Rakefile
Created October 29, 2016 17:27
Rake script to migrate all repos from Bitbucket org to Github org
# gem install bitbucket_rest_api
# gem install octokit
require 'bitbucket_rest_api'
require 'octokit'
task :migrate do
bitbucket = BitBucket.new login: '', password: ''
bitbucket_owner = ''
github = Octokit::Client.new login: '', password: ''
github_org = ''

Back to Basics: Validations in Rails

rails new basics --skip-bootsnap --skip-bundle --skip-action-cable --skip-active-storage --skip-action-mailer --skip-yarn --skip-sprockets --skip-turbolinks --skip-coffee --skip-javascript --database=postgresql
rails db:setup db:migrate
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"