Skip to content

Instantly share code, notes, and snippets.

View visoft's full-sized avatar

Damien White visoft

View GitHub Profile
@stakes
stakes / attribute_serializer.rb
Created February 24, 2011 20:11
Attribute Serializer with dynamic finders
module AttributeSerializer
module ActiveRecordExtensions
module ClassMethods
def serializeable(serialized, serialized_accessors={})
serialize serialized, serialized_accessors.class
serialized_attr_accessor serialized, serialized_accessors
@chrisgaunt
chrisgaunt / rails_test_engine_cucumber.markdown
Created August 3, 2011 03:57
Rails 3.1: Test engine with Cucumber & test/dummy app

Run from the root of the engine project:

rails generate cucumber:install --capybara

Edit features/support/env.rb and add to the top:

ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../../test/dummy/config/environment.rb",  __FILE__)
ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "../../../test/dummy"
@rwilcox
rwilcox / keymando.rb
Created August 9, 2011 12:25
Useful motion commands for Keymando (also, example of command, delete)
# Motion commands
map "<Alt-Delete>", "<Alt-Right><Alt-Delete>" # Delete entire current word
map "<Cmd-Alt-Delete>", "<Cmd-Right><Cmd-Delete>" # Delete entire current line
# Move the current line one line up, or one line down (switch this line with the line currently
# above or below it)
#
# See also: TextMate's Text -> Move Selection -> Line Up (or Line Down)
map "<Cmd-Ctrl-Up>", "<Cmd-Left><Shift-Cmd-Right><Cmd-x><Delete><Up><Return><Shift-Cmd-Left><Delete><Cmd-v>"
map "<Cmd-Ctrl-Down>", "<Cmd-Left><Shift-Cmd-Right><Cmd-x><Delete><Down><Cmd-Right><Return><Shift-Cmd-Left><Delete><Cmd-v>"
Hi David,
I came across your profile online and wanted to reach out about Development
Opportunities here at Groupon. The company is growing, and we're always
looking for folks with solid skills that can make positive contribution to
our continued success. Any chance you'd be open to a quick conversation
about opportunities, or for any possible networking potential? If so, let me
know when you're free and we can set up a time to chat. Also, if you are
interested, it would be great if you could forward a current resume over
that I can take a look at. I look forward to hearing back from you! Please
let me know if you have any questions.
@bouchard
bouchard / gist:1528761
Created December 28, 2011 17:18
Force Lowercase and Force Parameterize for Acts as Taggable On.
module ActsAsTaggableOn
class TagList < Array
cattr_accessor :force_lowercase, :force_parameterize
self.force_lowercase = false
self.force_parameterize = false
private
# Remove whitespace, duplicates, and blanks.
def clean!
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@lexrus
lexrus / asicon.sh
Created March 6, 2012 08:48
AppStore Icons Generator
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install ImageMagick with MacPort: sudo port install ImageMagick
convert $1 -resize 512x512 iTunesArtwork.png # Ad Hoc iTunes
convert $1 -resize 144x144 Icon-72@2x.png # Home screen for "The New iPad"
convert $1 -resize 114x114 Icon@2x.png # Home screen for Retina display iPhone/iPod
convert $1 -resize 72x72 Icon-72.png # App Store and Home screen on iPad
convert $1 -resize 58x58 Icon-Small@2x.png # Spotlight and Settings for Retina display
convert $1 -resize 57x57 Icon.png # Home screen on non-Retina iPhone/iPod
convert $1 -resize 50x50 Icon-Small-50.png # Spotlight on iPad 1/2
@pgaertig
pgaertig / transpose_table.js
Created April 13, 2012 13:48
Transpose HTML table using jQuery
$(function() {
var t = $('#thetable tbody').eq(0);
var r = t.find('tr');
var cols= r.length;
var rows= r.eq(0).find('td').length;
var cell, next, tem, i = 0;
var tb= $('<tbody></tbody>');
while(i<rows){
cell= 0;
@myronmarston
myronmarston / ways_to_use_vcr.rb
Created April 13, 2012 15:00
Ways to use VCR for a request made by a let block
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.
@tuzz
tuzz / github.css
Last active May 20, 2024 11:57
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: