Skip to content

Instantly share code, notes, and snippets.

View abitdodgy's full-sized avatar
😃
Out to lunch!

Mohamad El-Husseini abitdodgy

😃
Out to lunch!
View GitHub Profile
@abitdodgy
abitdodgy / README.md
Created November 8, 2016 00:02 — forked from raysegantii/README.md
Use bootstrap-sass npm package with Phoenix's brunch
  1. install npm packages
  2. update brunch-config.js
  3. rename web/static/css/app.css to web/static/css/app.scss
  4. update web/static/css/app.scss
@abitdodgy
abitdodgy / Heroku_Staging.md
Last active August 29, 2015 14:27 — forked from stevenyap/Heroku_Staging.md
Staging workflow on Heroku

This describes the workflow to use Heroku as a staging environment. It assumes you already have an existing heroku app in production.

# rename your git remote heroku to something else like production
git remote rename heroku production

# so now you will push as: git push production master

# create the staging app
heroku apps:create staging-appname
@abitdodgy
abitdodgy / documents.rb
Last active August 29, 2015 14:23 — forked from dhh/documents.rb
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@abitdodgy
abitdodgy / gist:4007431
Created November 3, 2012 13:50 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt