Skip to content

Instantly share code, notes, and snippets.


Richard Hollis richhollis

View GitHub Profile
richhollis / response.html
Created January 10, 2017 12:30
RubyMoney/google_currency captcha html response
View response.html
<!DOCTYPE html>
(function(){(function(){function e(a){this.t={};this.tick=function(a,c,b){var d=void 0!=b?b:(new Date).getTime();this.t[a]=[d,c];if(void 0==b)try{window.console.timeStamp("CSI/"+a)}catch(h){}};this.tick("start",null,a)}var a,d;window.performance&&(d=(a=window.performance.timing)&&a.responseStart);var f=0<d?new e(d):new e;window.jstiming={Timer:e,load:f};if(a){var c=a.navigationStart;0<c&&d>=c&&(}if(a){var b=window.jstiming.load;0<c&&d>=c&&(b.tick("_wtsrt",void 0,c),b.tick("wtsrt_","_wtsrt",
d),b.tick("tbsd_","wtsrt_"))}try{a=null,,b&&0<c&&(b.tick("_tbnd",void 0,,b.tick("tbnd_","_tbnd",c))),null==a&&window.gtbExternal&&(a=window.gtbExternal.pageT()),null==a&&window.external&&(a=window.external.pageT,b&&0<c&&(b.tick("_tbnd",void 0,window.external.startE),b.tick("tbnd_","_tbnd",c))),a&&(}catch(g){}})();}).call(this);
richhollis / add_user_name_to_users.rb
Last active May 9, 2020 07:26
Rails and Devise 3.5.6 using attr_encrypted with email attribute encrypted and username clear text
View add_user_name_to_users.rb
class AddUserNameForAuthenticationToUsers < ActiveRecord::Migration
def up
add_column :users, :username, :string, null: false, default: ""
add_index :users, :username, unique: true
add_column :users, :encrypted_email, :string
remove_column :users, :email, :string
add_index :users, :encrypted_email
def down
remove_column :users, :username
richhollis /
Created February 1, 2016 12:41 — forked from xrstf/
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for and


For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

richhollis / application.rb
Created January 8, 2016 18:00 — forked from averyvery/application.rb
Inline CSS or JS in Rails
View application.rb
config.assets.precompile += [
# precompile any CSS or JS file that doesn't start with _
richhollis / .fonts.conf
Last active August 29, 2015 14:08 — forked from silv3rm00n/.fonts.conf
Fix rspec and capybara errors
View .fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
Documented at
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
View free_email_provider_domains.txt
richhollis / cors_middleware.rb
Last active August 16, 2017 20:33
CorsMiddleware which can be useful for testing SwaggerUI resources in development
View cors_middleware.rb
class CorsMiddleware
def initialize(app)
@app = app
def call(env)
default_headers = {
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, POST, DELETE, PUT, PATCH, OPTIONS',
'Access-Control-Allow-Headers' => 'Content-Type, api_key, Authorization, origin'
richhollis / gist:4185765d817b106c3aab
Created August 29, 2014 16:25
Test backbone pubSub event triggers call their expected functions in jasmine spec
View gist:4185765d817b106c3aab
class BackbonePubSub
@verifyEvent: (klass, name, methodName, callMethod = "registerEvents") ->
match = false
oldFn = Backbone.pubSub.on # get existing pubSub.on method
class KlassNoConstructor extends klass # extend original class so we can disable constructor
constructor: -> # zap the constructor of the target class
instance = new KlassNoConstructor
Backbone.pubSub.on = (triggerName, method) ->
match = true if triggerName == name and method == instance[methodName] # are we triggering on the right method?