Skip to content

Instantly share code, notes, and snippets.

View dwaynemac's full-sized avatar

Dwayne Macgowan dwaynemac

View GitHub Profile
@mrmartineau
mrmartineau / stimulus.md
Last active May 12, 2024 04:35
Stimulus cheatsheet
@synth
synth / add_signature_fields_to_delayed_jobs.rb
Last active November 21, 2023 10:03
Prevent Duplicates with Delayed Jobs
class AddFieldsToDelayedJobs < ActiveRecord::Migration
def change
add_column :delayed_jobs, :signature, :string
add_column :delayed_jobs, :args, :text
end
end
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 5, 2024 17:27
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jraines
jraines / rails31init.md
Created May 24, 2011 17:03
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@olivoil
olivoil / persisting_mongoid_criteria.rb
Created March 15, 2011 16:18
Example model to persist Mongoid::Criteria as Searches
class Search
include Mongoid::Document
field :query, :type => Hash
field :collection
embedded_in :user
def to_criteria
Mongoid::Criteria.new( collection.titleize.constantize ).fuse( query )
@marcgg
marcgg / gist:733592
Created December 8, 2010 17:26
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great