Skip to content

Instantly share code, notes, and snippets.

View timcheadle's full-sized avatar

Tim Cheadle timcheadle

View GitHub Profile
@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 / 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 / ethiopian-to-gregorian-in-excel.md
Last active November 17, 2020 15:34
Excel formula to convert Ethiopian calendar dates to Gregorian dates

Convert Ethiopian dates to Gregorian dates in Excel

Formula

This formula operates on an Ethiopian date in cell A2. It assumes that cell uses a mm/dd/yyyy format, where the months are 1-13.

= IF(ISBLANK(A2), "", DATE(RIGHT(TEXT(A2, "mm/dd/yyyy"), 4) + 8, 1, 1) + ((LEFT(TEXT(A2, "mm/dd/yyyy"), 2) * 30) - 120 + MID(TEXT(A2, "mm/dd/yyyy"), 4, 2) - IF(MOD(RIGHT(TEXT(A2, "mm/dd/yyyy"), 4) + 1, 4) <> 1, 23, 22)))
@timcheadle
timcheadle / readme.md
Last active August 1, 2019 14:05
csvhead – easily preview CSV column names, order, and sample data
@timcheadle
timcheadle / README.md
Last active January 31, 2017 03:29
Run Mailcatcher with rbenv automatically in the background on OS X

Mailcatcher makes it super easy to preview emails locally for development. These instructions let you run it all the time in the background on OS X.

Note: This assumes you are using rbenv

First, install mailcatcher. Do this in your home directory because it often has gem conflicts otherwise.

cd ~ && gem install mailcatcher
@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 / 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 / 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 / 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 / File List
Created October 30, 2011 03:26
Compass Sprites Example
$ find images/icons
images/icons
images/icons/minus.png
images/icons/plus.png