Skip to content

Instantly share code, notes, and snippets.

View timcheadle's full-sized avatar

Tim Cheadle timcheadle

View GitHub Profile
@timcheadle
timcheadle / nivo-slider.css
Created June 3, 2011 14:15
Nivo Slider Image Advance on Click
.slider {
cursor: pointer;
}
.nivo-directionNav a {
position:absolute;
top:45%;
z-index:9;
cursor:pointer;
display: none;
@timcheadle
timcheadle / File List
Created October 30, 2011 03:26
Compass Sprites Example
$ find images/icons
images/icons
images/icons/minus.png
images/icons/plus.png
@timcheadle
timcheadle / archive.txt
Created May 6, 2012 17:14
Archive Links from Blog Carnival
May 03, 2012: http://practicegoodtheory.blogspot.com/2012/05/objectivist-roundup-may-3-2012.html
Apr 26, 2012: http://rationaljenn.blogspot.com/2012/04/objectivist-round-up-249.html
Apr 19, 2012: http://jasonstotts.com/2012/04/objectivist-blog-carnival-13/
Apr 12, 2012: http://ruleofreason.blogspot.com/2012/04/objectivist-round-up.html
Mar 29, 2012: http://theplayfulspiritrachel.blogspot.com/2012/03/objectivist-round-up.html
Mar 22, 2012: http://witlab.blogspot.com/2012/03/objectivist-round-up.html
Mar 16, 2012: http://ruleofreason.blogspot.com/2012/03/objectivist-round-up_15.html
Mar 11, 2012: http://practicegoodtheory.blogspot.com/2012/03/greece-defautls.html
Mar 01, 2012: http://ruleofreason.blogspot.com/2012/03/objectivist-round-up.html
Feb 23, 2012: http://rationaljenn.blogspot.com/2012/02/objectivist-round-up-241.html
@timcheadle
timcheadle / README.md
Last active January 26, 2023 00:56
Make /robots.txt aware of the Rails environment

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

@timcheadle
timcheadle / registrations_controller.rb
Created September 21, 2012 17:13
Allow Users to edit their profile/settings in Devise without requiring the current password
#
# Custom registration handlers for users (override devise's defaults)
#
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :authenticate_user!
# Override the devise update method for registrations
def update
@user = User.find(current_user.id)
@timcheadle
timcheadle / bookmarket.js
Created October 4, 2012 15:29
Amazon Associate Link Bookmarklet
javascript:(function()%7Bassociate_tag%3D%27fourspace-20%27%3Blink%3D%27http://amazon.com/dp/%27%2Bdocument.getElementById(%27ASIN%27).value%2B%27/%3Ftag%3D%27%2Bassociate_tag%3Bwindow.prompt(%22Copy%20to%20clipboard:%22,link)%3B%7D)()%3B
@timcheadle
timcheadle / Gemfile
Last active August 29, 2015 13:56
Devise + Omniauth + Google Apps (without passwords)
# Devise
gem 'devise', '~> 3.0.1'
# OpenID (for Google Apps SSO)
gem 'omniauth-google-apps'
@timcheadle
timcheadle / application_helper.rb
Created June 6, 2014 18:11
Fixed redcarpet view helper in Rails using :with_toc_data. Works around vmg/redcarpet#385
module ApplicationHelper
def markdown_toc(&block)
output = []
content = capture(&block)
unsafe_chars_regex = /[ $&+,\/:;=?@\"<>#%{}|\^~\[\]`]+/o
# Render the Table of Contents
renderer = Redcarpet::Render::HTML_TOC
@timcheadle
timcheadle / server.conf
Last active April 19, 2024 09:53
SSL nginx config example
server {
listen 80;
server_name www.example.com example.com;
# Redirect all traffic to SSL
rewrite ^ https://$host$request_uri? permanent;
}
server {
listen 443 ssl default_server;
@timcheadle
timcheadle / Guardfile
Created May 6, 2015 17:51
Middleman + Guard + shopify_theme
require 'yaml'
guard :shell do
watch(/source\/(.*)/) { |m| `bundle exec middleman build --clean` }
watch(/build\/(.*)/) do |m|
break if m[0] == 'build/config.yml'
store = ''
if File.exist?('build/config.yml')