Skip to content

Instantly share code, notes, and snippets.

View richhollis's full-sized avatar

Richard Hollis richhollis

View GitHub Profile
# an example, showing how to load for rspec and conditionally load for cucumber
# lives in whichever dir you set the other file to load
module ImageStepHelpers
def page_should_contain_image_link_for(image)
page.should have_xpath(%Q(//img[@src="#{image.url}"]))
end
def image_data_from_file(image)
image_file_path = Rails.root.join image.image.path
@richhollis
richhollis / dropbox-monit
Last active May 11, 2016 14:33
Shell script for monit to launch dropbox daemon with ionice idle priority and cpu limit 20%
check process dropbox with pidfile /home/username/.dropbox/dropbox.pid
start program = "/home/username/.dropbox-dist/dropboxd-nice"
as uid username and gid username
stop program = "bin/bash -c '/bin/kill -9 `cat /home/username/.dropbox/dropbox.pid`'"
as uid username and gid username
@richhollis
richhollis / gist:4185765d817b106c3aab
Created August 29, 2014 16:25
Test backbone pubSub event triggers call their expected functions in jasmine spec
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?
@richhollis
richhollis / cors_middleware.rb
Last active August 16, 2017 20:33
CorsMiddleware which can be useful for testing SwaggerUI resources in development
class CorsMiddleware
def initialize(app)
@app = app
end
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'
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com

Setting up a PositiveSSL Wildcard Certificate from Comodo for Apache with Trusted by Microsoft and Firefox

This gist was greatly helped by the direction in this gist:

https://gist.github.com/bradmontgomery/6487319

Examine your certificate in the browser (Chrome):

  • Click on the padlock
  • Click Connection
@richhollis
richhollis / .fonts.conf
Last active August 29, 2015 14:08 — forked from silv3rm00n/.fonts.conf
Fix rspec and capybara errors
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Documented at
http://linux.die.net/man/5/fonts-conf
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
@richhollis
richhollis / application.rb
Created January 8, 2016 18:00 — forked from averyvery/application.rb
Inline CSS or JS in Rails
config.assets.precompile += [
# precompile any CSS or JS file that doesn't start with _
/(^inline[^_\/]|\/[^_])[^\/]*.(js|css)$/,
...
@richhollis
richhollis / letsencrypt.md
Created February 1, 2016 12:41 — forked from xrstf/letsencrypt.md
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 http://letsencrypt.readthedocs.org/en/latest/using.html 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 www.example.com and example.com).

Configuration

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