Skip to content

Instantly share code, notes, and snippets.

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active August 6, 2025 20:50
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@bendyorke
bendyorke / setup.md
Last active March 12, 2021 14:25
Setting up a new mac
@mupkoo
mupkoo / google_analytics.coffee
Last active March 20, 2016 23:08
Google Analytics snippet for Turbolinks
class @GoogleAnalytics
@load: ->
# Load the analytics code
window['GoogleAnalyticsObject'] = 'ga'
window['ga'] = window['ga'] || ->
(window['ga'].q = window['ga'].q || []).push arguments
window['ga'].l = 1 * new Date()
# Add the script
@patrickhammond
patrickhammond / android_instructions.md
Last active July 22, 2025 02:25
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@Jursdotme
Jursdotme / block-grid.scss
Last active January 21, 2021 17:03
Foundation 5 style Block-Grid for Bootstrap 3 (SASS Version)
// Block Grid
// Technique adapted from Foundation 5 for Bootstrap 3.
// https://github.com/zurb/foundation/blob/f755d8704123f86c281ede0b171881e2672f150d/scss/foundation/components/_block-grid.scss
// Original LESS Version by Christopher Mitchell (https://gist.github.com/ChrisTM)
// Converted to SCSS by Rasmus Jürs (https://github.com/Jursdotme)
[class*="block-grid-"] {
display: block;
margin: -($grid-gutter-width/2);
padding: 0;
@parndt
parndt / gist:11381872
Last active May 29, 2019 11:59
Asset precompilation from an Engine's initializer
### RAILS 4.1
# Doesn't work, due to the error:
# Asset filtered out and will not be served: add
# `Rails.application.config.assets.precompile += %w( refinery/refinery.css )`
# to `config/initializers/assets.rb` and restart your server
class MyEngine < Rails::Engine
# set the manifests and assets to be precompiled
initializer "refinery.assets.precompile" do |app|
@blotto
blotto / cleaners.rb
Created April 9, 2014 22:15
Some Sidekiq helper methods
module AsyncTools
module Cleaners
def self.find_job_for_object_by_method(klass, method)
jobs = Sidekiq::ScheduledSet.new
jobs.select { |job|
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
class PaymentService
VALID_CURRENCIES = Money::Currency.table.keys.map(&:upcase)
DEFAULT_CURRENCY = :EUR
APP_FEE = ->(amount) { amount * 15 / 100}
def initialize(user)
@user = user
@app_id = ENV['STRIPE_APP_ID']
@app_secret = ENV['STRIPE_KEY']
@client = OAuth2::Client.new(@app_id, @app_secret, site: 'https://connect.stripe.com')
@localhots
localhots / application_controller.rb
Created March 6, 2014 16:15
Clear impersonation logic in Rails
def session_user
@session_user ||= if current_user.admin? && params[:user_id].present?
User.find(params[:user_id])
else
current_user
end
end