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
@andyshinn
andyshinn / Dockerfile
Last active Jul 29, 2019
Postal on Docker
View Dockerfile
FROM ruby:2.3-onbuild
VOLUME /opt/postal/config
ENV LOG_TO_STDOUT 1
ENV AM_CONFIG_ROOT /opt/postal/config
RUN gem install procodile
RUN apt-get update -qq && apt-get install -yqq nodejs
View wait-google-sent-me.js
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@kachayev
kachayev / concurrency-in-go.md
Last active Jul 30, 2019
Channels Are Not Enough or Why Pipelining Is Not That Easy
View concurrency-in-go.md
View 0. Ruby Meta Programming - spells covered.md
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@tzvetkoff
tzvetkoff / gist:7287456
Last active Jan 8, 2019
Make it more test-ish
View gist:7287456
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', :github => 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@kyletcarlson
kyletcarlson / rspec_model_testing_template.rb
Last active Aug 20, 2019
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active Jul 17, 2019
How to set up stress-free SSL on an OS X development machine
View how-to-set-up-stress-free-ssl-on-os-x.md

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@developer88
developer88 / active_admin.rb
Last active Mar 19, 2016
This is my gist that show how we can use CanCan with ActiveAdmin and store permissions in database.
View active_admin.rb
# config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
config.current_user_method = :current_user
config.authentication_method = :authenticate_user!
config.before_filter :admin_role_filter
end
# Adding all recource names to Permissions table after ActiveAdmin is loaded
@ndarville
ndarville / business-models.md
Last active Jul 30, 2019
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.
View business-models.md

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
You can’t perform that action at this time.