Skip to content

Instantly share code, notes, and snippets.


Josh Brody joshmn

Block or report user

Report or block joshmn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
joshmn / routes.rb
Created Sep 28, 2018
actual routes
View routes.rb
class SiteConstraint
def matches?(request)
request.subdomain != 'my' && request.domain != 'localhost'
class AppConstraint
def matches?(request)
request.subdomain === 'my' || request.domain == 'localhost'
joshmn /
Last active Jun 5, 2018
this rack app will return whatever http status code you want, too.
# Make sure this is named
# install the gem with
# $ gem install rack
# Usage: rackup
require 'rack'
joshmn / gemfile_sort.rb
Created Aug 1, 2017
sort your gemfile lol
View gemfile_sort.rb
file ="test.gemfile")
open_group = false
default_groups = [:general]
current_groups = default_groups
gem_groups = {}
gems = {}
file.split("\n").each do |line|
joshmn / contact.rb
Created May 4, 2017 — forked from endymion/contact.rb
Example of integrating a Ruby on Rails app with Zapier using the REST hooks pattern. With support for triggering the REST hooks from Resque background jobs.
View contact.rb
class Contact < ActiveRecord::Base
def after_create
if Hook.hooks_exist?('new_contact', self)
# To trigger directly without Resque: Hook.trigger('new_contact', self)
joshmn / fish.conf
Created May 5, 2016 — forked from Epigene/fish.conf
Fish2 configuration file
View fish.conf
# Path to Oh My Fish install.
set -gx OMF_PATH /Users/augusts/.local/share/omf
source $OMF_PATH/
# Path to your oh-my-fish.
set PATH /Applications/ $PATH
set PATH ~/bin $PATH
set PATH /usr/local/bin $PATH
set -x RACK_ENV development
set -x EDITOR atom
joshmn / powerball.json
Created Jan 13, 2016
Powerball winners
View powerball.json
"date": "2016-01-09",
"winners": [16, 19, 32, 34, 57],
"powerball": 13
}, {
"date": "2016-01-06",
"winners": [2, 11, 47, 62, 63],
"powerball": 17
}, {
"date": "2016-01-02",
joshmn / gist:6831378
Created Oct 4, 2013
Accept non-GET AJAX via jQ while Authenticated inside a Ruby on Rails application (devise, simpleauth)
View gist:6831378
$(document).ajaxSend(function (_, xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
View gist:220fe03bc162118e23da
# backup
echo Performing Mediawiki backup...
# Perform MySQL dump
echo Performing MySQL dump...
mysqldump <database_name> -h<database_host> -u<database_username> -p<database_password> > /opt/backup/data/mysql.bck
# Create mediawiki tarball
echo Creating mediawiki tarball...
cd /opt/mediawiki/
joshmn / Readme
Last active Sep 18, 2015
ActiveAdmin Logs
View Readme
Inspired by Gitlab's Admin Logs (app/controllers/admin/logs_controller.rb)
Probably should put things in lib. Put in one file for breviety.
You can’t perform that action at this time.