Skip to content

Instantly share code, notes, and snippets.

View codatory's full-sized avatar

Alex Conner codatory

View GitHub Profile
@codatory
codatory / init.el
Created February 6, 2012 14:56
My emacs init.el
;; emacs configuration
(push "/usr/local/bin" exec-path)
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
(setq tramp-default-method "scpx")
CURRENT=`pwd`
mkdir /tmp/repo_archive
cd /tmp/repo_archive
git clone --quiet --bare "$CURRENT" repository
tar -c repository | pigz --best > "$CURRENT/archive.tar.gz"
cd $CURRENT
rm -rf /tmp/repo_archive
class ExifData
require 'celluloid'
def initialize(file)
raise 'Expects Upload!' unless file.is_a?(Upload)
@upload = file
end
def process!
# this is fictitional
# Configuration Constants (move to yaml ?)
HOST = 'ad01.domain.local'
PORT = 636
USER = 'administrator'
PASS = 'password'
BASE = 'dc=domain, dc=local'
DOMAIN = 'domain.local'
SCOPE = '(&(objectCategory=person)(objectClass=user))'
require 'rubygems'
#!/bin/bash
# Mac Bootstrap Script
# (C) 2011 - @codatory
#
# "It might work for you, too."
pretty_echo(){
echo '--------------------------------'
echo " $*"
@codatory
codatory / whatismyip.bash
Created November 8, 2011 16:38
WhatIsMyIP Bash Function
whatismyip() {
IP=`curl --silent http://ip.appspot.com/`
echo "External IP: ${IP}"
}
@codatory
codatory / rails_project_start_checklist.markdown
Created November 3, 2011 17:51
(Ideal) Rails Project Pre-Start Checklist

(Ideal) Rails Project Pre-Start Checklist

Source Control

  • Code is under source control (git) with a remote I can read/write to

Testing

  • Be aware of test coverage
  • Code is under continuous integration

Deployment

  • The code has a known deployment process
@codatory
codatory / import.rb
Created September 12, 2011 16:30
Chardet CSV Example
file = params[:csv].open
chardet = CharDet.detect(file.read[0..200])
if chardet['confidence'] > 0.7
charset = chardet['encoding']
else
raise 'Unable to detect file encoding'
end
csv = CSV.parse(Iconv.conv('ASCII//IGNORE//TRANSLIT',charset,file.open.read), :headers => true)
@codatory
codatory / database.yml
Created September 7, 2011 22:15
Default database.yml
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
Process: ruby [54093]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [8695]
Date/Time: 2011-08-23 17:24:42.402 -0400
OS Version: Mac OS X 10.7.1 (11B26)
Report Version: 9