Skip to content

Instantly share code, notes, and snippets.

#models/my_thing.rb
class MyThing < ActiveRecord::Base
belongs_to :user
acts_as_activity :user
end
#views/activities/_unhandled_item.html.haml
- case activity.item_type
- when 'MyThing'
="created a MyThing: #{link_to(activity.item.name, user_my_thing_path(activity.item.user, activity.item))}"
@bborn
bborn / mceoptions.rb
Created October 23, 2009 15:46
put this in your initializers directory
# getting nil.merge errors in production when overriding a controller in CE?
AppConfig ||= OpenStruct.new
AppConfig.default_mce_options = {
:theme => 'advanced',
:browsers => %w{msie gecko safari},
:theme_advanced_layout_manager => "SimpleLayout",
:theme_advanced_statusbar_location => "bottom",
:theme_advanced_toolbar_location => "top",
:theme_advanced_toolbar_align => "left",
@bborn
bborn / heroku_deploy.rake
Created November 12, 2009 20:11
a simple script to automate deploying a CE app with submodules to heroku
desc "Deploy to Heroku"
task :deploy_heroku do
app = 'myappname'
temp_path = "/tmp/heroku-deploys/#{app}"
deploy_path = "~/heroku-deploys/#{app}"
system "mkdir -p #{temp_path}"
system "rm -rf #{temp_path}/*"
system "tar -C . -cf - . | tar -C #{temp_path}/ -xpf -"
system "cd #{temp_path} && find . -regex '.*git.*' -exec rm -rf {} \\;"
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@bborn
bborn / schema.rb
Created March 21, 2013 16:10
example CE schema
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#!/bin/sh -e
APP_NAME=$1
PIPELINE_APP_NAME=$APP_NAME-slug
HEROKU_APP_REMOTE=git@heroku.com:$APP_NAME.git
HEROKU_PIPELINE_REMOTE=git@heroku.com:$PIPELINE_APP_NAME.git
WORKERS_COUNT=$(heroku ps --app $APP_NAME | grep "^worker." | wc -l | tr -d ' ')
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
LOCAL_DEPLOY_START=`date +%s`
<a class="rcptr" href="http://www.rafflecopter.com/rafl/display/2faae1235/" rel="nofollow" data-raflid="2faae1235" data-theme="classic" data-template="" id="rcwidget_953v93k7">a Rafflecopter giveaway</a>
<script src="//widget-prime.rafflecopter.com/launch.js"></script>
@bborn
bborn / medium.undomanager.js.coffee
Last active August 29, 2015 14:19
Medium undo manager
#= require rangy
#= require rangy/rangy-selectionsaverestore
#= require jquery.debounce
#= require jquery-observe/jquery-observe
#= require medium/undo
class @UndoManager
defaults = {
debounceRate: 100
}
<div style="margin: 10px 0; max-width: 550px;"><a data-width="100%" data-height="auto" id="ld-8508-352" href="http://lockerdome.com/7756894043381057/7808653298244634">Adobe Photoshop Elements 13 Giveaway</a><span id="ld-8508-352-equiv"> in <a href="http://lockerdome.com/7756894043381057">ManMade Polls &amp; Giveaways</a> on <a href="http://lockerdome.com">LockerDome</a></span><script>(function(d,s,id,elid) {window.ldInit = window.ldInit || []; ldInit.push(elid);if (d.getElementById(id)) return;var js, fjs = d.getElementsByTagName(s)[0];js=d.createElement(s); js.id=id;js.async=true;js.src="//cdn2.lockerdome.com/_js/embed.js";fjs.parentNode.insertBefore(js,fjs);}(document, "script", "lockerdome-wjs", "ld-8508-352"));</script></div>