Skip to content

Instantly share code, notes, and snippets.

View rossnelson's full-sized avatar
💀

Ross Nelson rossnelson

💀
View GitHub Profile
@rossnelson
rossnelson / swapper_activate.js
Created October 1, 2011 22:35
Swapper's potential usage
$(document).ready(function() {
$('.swap').swapper();
// or
$('.video_swap').swapper({
destination: 'video',
link_attr: 'href',
video_width: 526,
video_height: 296
});
# "https://maps.googleapis.com/maps/api/place/search/json?key=AIzaSyDKpxPRiMFWSaF99KRLnGf6EiJPTGzuIvk&location=-33.966136,151.102687&name=harbour&radius=500&sensor=false&types=food"
search = Google::PlacesSearch.new({
:lat => "-33.966136",
:lng => "151.102687",
:radius => "500",
:types => "food",
:name => "harbour",
:sensor => "false",
:key => "AIzaSyDKpxPRiMFWSaF99KRLnGf6EiJPTGzuIvk",
:user_ip => "184.60.81.8"
@rossnelson
rossnelson / Rails 3 Environment
Last active September 29, 2015 08:48 — forked from laserlemon/Rails 3 Environment
Snow Leopard, Homebrew, Git, RVM, Ruby, Passenger, Apache, MySQL and ImageMagick
# 2012-01-07
#
# Mac OS X 10.6.8
# Homebrew 0.7
# Xcode 3.2.4
# Git 1.7.3.1
# RVM 1.0.12
# Ruby 1.9.2, 1.8.7
# Rails 3.0.0
# Passenger 3.0.0.pre4
@rossnelson
rossnelson / Clean to Code.md
Created January 16, 2012 01:05
Lion, Xcode, GIT, RVM, Passenger, Mysql, ImageMagick

2012-01-15

  • Mac OS X 10.7.2
  • Homebrew 0.8.1
  • Apple Command Line Tools
  • ZSH
  • Git 1.7.5.4
  • RVM 1.10.1
  • Ruby 1.9.3
  • Passenger 3.0.11
@rossnelson
rossnelson / app_controller.rb
Created January 23, 2012 19:38
Block Region Setup
# Build instance variables for block regions and loads an
# array of blocks into them
def load_blocks
@regions = Block.regions
@blocks = regions.blocks
@block_regions = regions.regions
@block_regions.each do |block, value|
instance_variable_set "@#{block}", @blocks.select{ |b| b if b.where_to_show == value }
end
@rossnelson
rossnelson / _contact.html.haml
Created January 24, 2012 15:52
Google Map API V3 example
= render "maps/map", :map => @map
@rossnelson
rossnelson / admin-rendering_controller.rb
Created January 29, 2012 02:12
Locomotive's multi site magic
module Admin
class RenderingController < ActionController::Base
include Locomotive::Routing::SiteDispatcher
include Locomotive::Render
before_filter :require_site
before_filter :authenticate_admin!, :only => [:edit]
before_filter :validate_site_membership, :only => [:edit]
@rossnelson
rossnelson / .vimrc
Created February 2, 2012 01:58
my .vimrc
" Use Pathogen:
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
" ================
" Ruby stuff
" ================
syntax on " Enable syntax highlighting
filetype plugin indent on " Enable filetype-specific indenting and plugins
@rossnelson
rossnelson / how-to-use-it.rb
Created April 22, 2012 18:42
Yaml to object with Middleman
# get the yaml as a hash and pass it in to the new method
@sites = Portfolio::Site.new(data.sites)
# returns an array of Portfolio::Site objects
@sites.all
@rossnelson
rossnelson / postgres-queries.rst
Created April 28, 2012 18:04 — forked from madelfio/postgres-queries.rst
Useful Postgres Admin Queries

Useful Postgres Admin Queries

  • pg_stat_activity (currently executing queries):

    select * from pg_stat_activity where current_query not like '<%';
  • pg_user (all database users):

    select * from pg_user;