Skip to content

Instantly share code, notes, and snippets.


Chris Arcand chrisarcand

View GitHub Profile
chrisarcand / UsingGitInYourGemspec_example1.rb
Last active August 29, 2015 13:56
Using Git in Your Gemspec
View UsingGitInYourGemspec_example1.rb
# A generated gemspec file using Bundler
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'test/version' do |spec| = "test"
spec.version = Test::VERSION
chrisarcand / UsingGitInYourGemspec_example2.rb
Created February 13, 2014 22:54
Using Git in Your Gemspec, example 2
View UsingGitInYourGemspec_example2.rb
# Part of Bundler's gemspec
spec.files = `git ls-files -z`.split("\x0")
spec.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
chrisarcand / UsingGitInYourGemspec_example3.rb
Created February 13, 2014 22:55
Using Git in Your Gemspec, example 3
View UsingGitInYourGemspec_example3.rb
# Part of Vagrant's gemspec
# The following block of code determines the files that should be included
# in the gem. It does this by reading all the files in the directory where
# this gemspec is, and parsing out the ignored files from the gitignore.
# Note that the entire gitignore(5) syntax is not supported, specifically
# the "!" syntax, but it should mostly work correctly.
root_path = File.dirname(__FILE__)
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
chrisarcand / keybase
Created February 5, 2016 15:57
View keybase
### Keybase proof
I hereby claim:
* I am chrisarcand on github.
* I am chrisarcand ( on keybase.
* I have a public key whose fingerprint is B981 8DC2 EE0C 17C3 75CF FA3C 6AF1 7E89 449B D250
To claim this, I am signing this object:
chrisarcand / dynamic_module_lookup.rb
Last active February 23, 2016 16:58
Dynamic module lookup in Ruby
View dynamic_module_lookup.rb
# What do you suppose the output of the examples are?
# Note: If you want to tinker executing these, don't just copy paste the entire file
# as defining everything in the same file acts differently (expected effects of reopening constants)
############## EXAMPLE 1 ##############
module NameHelper
def full_name
"#{first_name} #{last_name}"
View example_config.yml
rails: Rails
rspec: RSpec
ManageIQ: ManageIQ
rspec-expectations: RSpec/rspec-expectations
dug: dug
chrisarcand /
Last active November 3, 2016 02:27
Code snippets for "Programming Easter Eggs" -
public static boolean isUserAMonkey () /* Since: API Level 8 */
/* Returns "true" if the user interface is currently being messed with by a monkey. */
chrisarcand / serialization_difference.rb
Last active May 8, 2017 16:18
Serialization difference in Rails 5.1
View serialization_difference.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
# Activate the gem you are reporting the issue against.
chrisarcand / output.txt
Created July 25, 2017 21:08
Local failures
View output.txt
These failures occur locally but not on Travis.
Got them running Ruby 2.3 and 2.4, with region 0 and a non-zero region.
1) VMDB::Util.add_zip_entry(private) entry is a symlink to origin file, origin file is added with symlink's name
Failure/Error: zip.add(zip_entry, File.realpath(file_path))
#<Double (anonymous)> received :add with unexpected arguments
chrisarcand / bundler-1-15-4.txt
Created November 1, 2017 15:24
Resulting lockfiles for manageiq-smartstate with differing Bundler versions
View bundler-1-15-4.txt
revision: b1247a733ca35d13574526cafb106148ad2d673d
tag: v0.2.5-5
handsoap (0.2.5)
nokogiri (>= 1.2.3)