Skip to content

Instantly share code, notes, and snippets.

View unixmonkey's full-sized avatar

David Jones unixmonkey

View GitHub Profile
@unixmonkey
unixmonkey / .irbrc
Created December 11, 2009 21:56
.irbrc
require 'pp'
require 'irb/completion'
require 'rubygems'
require 'wirble'
require 'hirb'
Wirble.init
Wirble.colorize
IRB.conf[:AUTO_INDENT]=true
#!/usr/bin/env ruby
puts "\n** This is a regimen calculator based on the \"Get In Shape\" post on"
puts "** Justin Cunningham's \"Little Bit of Code\" blog post at"
puts "** http://littlebitofcode.com/2010/03/01/get-in-shape **\n\n"
class LiftCalc
attr_accessor :maxweight
def initialize
<!DOCTYPE html>
<html lang='en'>
<head>
<title>LiftCalc</title>
<meta http-equiv='Content-type' content='text/html;charset=UTF-8'>
<meta name='viewport' content='width=device-width'>
<meta name='viewport' content='initial-scale=1.6'>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type='text/javascript'>
@unixmonkey
unixmonkey / load_sass_variables.rb
Created March 5, 2010 21:45
initializer to load a yaml file into sass variables
# Throw this in config/initializers and add
# @import variables.sass to the top of application.sass
# to have all variables in app_config.yml
# available as variables in your sass stylesheets
sass_variables = []
app_variables = YAML.load_file("#{Rails.root}/config/app_config.yml")
app_variables.each do |key, value|
sass_vars << "!#{key} = #{value}"
@unixmonkey
unixmonkey / .irbrc
Created April 16, 2010 13:28 — forked from tjh/.irbrc
.irbrc
# *****************************************
# .irbrc
#
# Includes lots of nice stuff to make
# your irb and script/console ruby shell
# more pretty and productive
#
# *****************************************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx
IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
#!/bin/bash
### SELF-UPDATING BASH SCRIPT
### Checks for update online, if not found, runs itself
# CONFIG: SET UPDATE FILE
UPDATE_FILE="update.sh"
UPDATE_URL="http://example.com/${UPDATE_FILE}"
### UPDATING CODE
@unixmonkey
unixmonkey / flying_spaghetti_monster.rb
Last active September 3, 2020 12:37
Example Rails model with all the bells and whistles
# == Schema Information
#
# Table name: flying_spaghetti_monsters
#
# id :integer(4) not null, primary key
# awesomeness :string
# meatballs :boolean
# last_seen :datetime
# model-specific requires
@unixmonkey
unixmonkey / build_ubuntu_rails_server.sh
Created May 19, 2010 22:41
build_ubuntu_rails_server.sh
#!/bin/bash
# This bash script is intended to be a solid starting point
# for a Ruby on Rails application server on Ubuntu Linux.
# Edit these settings if you wish
HOSTNAME="railsmachine"
DEPLOYUSER="deploy"
RUBYDIR="/opt/ruby"
RAILSAPPNAME="railsapp"
@unixmonkey
unixmonkey / .profile
Created May 19, 2010 22:45
.profile - shortcuts and bash settings
# *****************************************
# .profile
#
# Includes lots of nice funtions
# and aliases to make your command-line
# experience happy and productive
#
# *****************************************
# Me and you; we have history, you know?