Skip to content

Instantly share code, notes, and snippets.

View harley's full-sized avatar

Harley Trung harley

View GitHub Profile
@harley
harley / install-redis.sh
Last active September 11, 2021 21:18 — forked from phamk/install-redis.sh
Use latest stable
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=stable
port=6379
@harley
harley / activeadmin-cancan.rb
Created July 6, 2012 02:30
Deep integration of CanCan into ActiveAdmin
# blog post:
module ActiveAdmin
module ViewHelpers
# lib/active_admin/view_helpers/auto_link_helper.rb
def auto_link(resource, link_content = nil)
content = link_content || display_name(resource)
if can?(:read, resource) && registration = active_admin_resource_for(resource.class)
begin
@harley
harley / survey_dsl.rb
Created March 29, 2012 01:59 — forked from huned/survey_dsl.rb
a survey DSL as valid ruby syntax
include Survey::DSL
survey 'Finances Questionnaire' do
q "Do you have a Durable Power of Attorney for Finances?" do
yes do
a "Who is the designated agent for handling your finances?" do
field 'Full Name'
phone 'Phone Number'
email 'Email'
@harley
harley / Gemfile
Created March 8, 2012 22:41
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin