Skip to content

Instantly share code, notes, and snippets.

module Campaign
class Base < ActiveRecord::Base
include Campaign::Data
include Campaign::State
include Campaign::Events
include Campaign::Presenters
include Campaign::Services
end
end
require 'active_support/concern'
module Campaign::Events
extend ActiveSupport::Concern
included do
def generate_event
Bus::Event::CampaignSubmittedForReview.create(:campaign => self)
end
end
(require '[clojure.string :as str])
(defn rename-underscore [sym]
[(symbol (str/replace (name sym) \_ \-))
(keyword sym)])
(defn udestructure [[lhs expr]]
(if (and (map? lhs)
(vector? (:_keys lhs)))
(let [msym (gensym)
something
git submodule add git://github.com/apotonick/cells
git submodule add git://github.com/apotonick/apotomo
git init
git update
@mikepence
mikepence / gist:1355359
Created November 10, 2011 16:46
Embed code for an Acts of Kindness widget
<script type="text/javascript">
var _aok = _aok || [];
// blank shows generic feed
_aok._flashtag = '';
</script>
<script type = "text/javascript" src = "http://aok.tv/widget"></script>
@mikepence
mikepence / gist:3953451
Created October 25, 2012 15:40
Code to fetch Facebook image for Catarse (latest code)
def self.create_with_omniauth(auth)
create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
user.name = auth["info"]["name"]
user.email = auth["info"]["email"]
user.email = auth["extra"]["user_hash"]["email"] if auth["extra"] and auth["extra"]["raw_info"] and user.email.nil?
user.nickname = auth["info"]["nickname"]
user.bio = auth["info"]["description"][0..139] if auth["info"]["description"]
user.locale = I18n.locale.to_s
@mikepence
mikepence / gist:3953440
Created October 25, 2012 15:38
Code to fetch Facebook image for Catarse
def self.create_with_omniauth(auth, primary_user_id = nil)
u = create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
user.name = auth["user_info"]["name"]
user.name = auth["user_info"][:name] if user.name.nil?
user.email = auth["user_info"]["email"]
user.email = auth["extra"]["user_hash"]["email"] if auth["extra"] and auth["extra"]["user_hash"] and user.email.nil?
user.nickname = auth["user_info"]["nickname"]
user.bio = auth["user_info"]["description"][0..139] if auth["user_info"]["description"]
class PlacardPanelWidget < Apotomo::Widget
has_widgets do
self << widget(:project_placard, 'project_1')
self << widget(:project_placard, 'project_2')
self << widget(:project_placard, 'project_3')
self << widget(:project_placard, 'project_4')
end
def display
@mikepence
mikepence / Gemfile
Created February 24, 2013 17:45 — forked from litch/Gemfile
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
...