Skip to content

Instantly share code, notes, and snippets.

View ginjo's full-sized avatar

William Richardson ginjo

View GitHub Profile
@ginjo
ginjo / _ginjo_tools
Last active February 21, 2018 00:31
Generic tools and libraries for Ginjo projects
We couldn’t find that file to show.
@ginjo
ginjo / safe-enum-value-pr.md
Last active December 9, 2017 12:17
Documentation for Enum::Value

Enum::Value

What it does

Enum::Value lets you create immutable value object instances from your Enum::Base subclasses. These Value instances delegate to the Enum::Base subclass for all read and write operations. Additionally, these instances are comparable with each other AND with strings, symbols, and integers (the integers representing enum indexes).

Simple setup

class Side < Enum::Base

values :left, :right, :whole

@ginjo
ginjo / rom_swap_datastore.rb
Created March 24, 2015 23:34
ROM swappable datastore example
# Swappable datastore example
ROM_ADAPTER = :sql # or :memory
# ...setup
class UsersSql < ROM::Relation[:sql]
dataset :users
def by_name(name)
@ginjo
ginjo / gist:aaa4a4395fcdbbad3d29
Last active December 1, 2019 08:32 — forked from bkimble/gist:1365005
Get structured array of hashes of memcached keys on multiple servers
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Forked from bkimble's gist https://gist.github.com/bkimble/1365005
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
# Currently resides at https://gist.github.com/ginjo/aaa4a4395fcdbbad3d29
#
# This fork separates the server query code from results presentation.
# The primary function of this script is to return an array of hashes of
# key items from any number of provided memcached servers.
@ginjo
ginjo / rvm-output.txt
Last active August 29, 2015 14:06
Rvm attempted wrapper generation & repair fails
user@host01:~$ rvm get head
Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/master.tar.gz
Upgrading the RVM installation in /usr/local/rvm/
Can not update 'scripts/zsh/Completion/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
Can not update 'scripts/extras/completion.zsh/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
Found 5384 files not belonging to 'rvm',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Found 1103 directories with mode different then '775',
@ginjo
ginjo / gist:60d087ee823dc73c15f4
Created September 24, 2014 06:48
Rvm repair wrappers failing
user@host:~/$ rvm repair wrappers
Regenerating all wrappers...
Regenerating wrappers for ruby-1.8.7-head.................................................................
Error running '__rvm_with ruby-1.8.7-head run_gem_wrappers_regenerate',
showing last 15 lines of /usr/local/rvm/log/1411540848/wrappers.regenerate.ruby-1.8.7-head.log
+ gem install gem-wrappers -v '>=1.2.4' --no-ri --no-rdoc
ERROR: Error installing gem-wrappers:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
@ginjo
ginjo / scheduled_job.rb
Created September 10, 2012 05:06 — forked from kares/scheduled_job.rb
Recurring Job using Delayed::Job
# # # # # scheduled_job.rb - recurring schedules for delayed_job.rb # # # # #
#
# This file is version controlled at https://gist.github.com/ginjo/3688965
#
# Forked from https://gist.github.com/kares/1024726
#
# This is an enhanced version of the original scheduled_job.rb
# It was born out of the need to schedule a whole bunch of simple jobs.
# I started with the sample below and quickly found that I was repeating
# a lot of code. So I created the Delayed::Task pseudo-class that allows