Skip to content

Instantly share code, notes, and snippets.

View sukima's full-sized avatar

Devin Weaver sukima

View GitHub Profile
#!/bin/bash
tmpdir=`mktemp -dt ios-sim.XXX`
buildpath="./build/Release/ios-sim"
destdir="$HOME/Library/Application Support/Titanium/mobilesdk/osx/3.1.3.GA/iphone"
success=false
pushd $tmpdir
git clone git@github.com:phonegap/ios-sim.git .
@gwright
gwright / features
Created April 3, 2014 19:35
ruby script to summarize local branch status relative to origin
#!/usr/bin/env ruby
#require 'pry'
#require 'pry-byebug'
def branch(group:nil)
case group
when :remote
flag = "-r"
when :all
module Shoulda # :nodoc:
module ActiveRecord # :nodoc:
module Matchers
def validate_format_of(attr)
ValidateFormatOfMatcher.new(attr)
end
class ValidateFormatOfMatcher < ValidationMatcher # :nodoc:
@vrinek
vrinek / avatar.rb
Created June 25, 2009 12:02
attachment_fu custom error messages
class Avatar < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 500.kilobytes,
:resize_to => 'c128x128',
:thumbnails => {:tiny => 'c24x24', :small => "c48x48"}
validates_as_attachment
after_validation :greeklize_attachment_errors
module ActiveRecord
class Base
def self.random
if (c = count) != 0
find(:first, :offset =>rand(c))
end
end
end
end
@sukima
sukima / fnotify.sh
Created July 16, 2010 12:20
Grab irssi notifications from a SSH server
#!/bin/sh
# Retrieve irssi notifications from fnotify script via SSH.
# See full blog post at
# http://dev.tritarget.org/2010/07/16/irssi-notifications-over-ssh.html
SSH_CMD="ssh -p 22 username@yourshell.org"
# Set this to what ever unique key generation you wish
RESET_KEY=`date | sha1sum | cut -d\ -f1`
@sukima
sukima / README.md
Created August 5, 2010 21:48
How to customize a global config YAML load in rails

I found this great [RailsCast][1] about making a global configuration. And further offered through the [Nifty Generators][2] (script/generate nifty_config) However I wanted to further customize it by allowing global configurations regardless of the environment.

For example this is the original idea: # config/config.yml development: perform_authentication: false

@sukima
sukima / application.js
Created August 6, 2010 23:36
jQuery datepicker with formtastic and rails
/**
* Shamlessly copied from http://snipt.net/boriscy/datetime-jquery-formtastic/
*
* This did not function with formtastic version 0.9.10
* I had to move the live("change") event below the initializing part
* I also had to adjust the jQuery selections as formtastic uses <ol>'s to
* seperate every select box.
*/
$(document).ready(function() {
@sukima
sukima / logged_in_as.rb
Created September 30, 2010 17:55
Using a custom shoulda macro for authlogic
# Sets the current person in the session from the person fixtures.
def logged_in_as(person, &block)
context "logged in as #{person}" do
setup do
@instructor = Factory(instructor) if instructor.is_a? Symbol
InstructorSession.create(instructor)
end
merge_block(&block)
end
@guybrush
guybrush / pandoc.css
Created October 18, 2010 05:42
pandoc.css
body {
font: Arial;
/*
font: 18px/27px 'YanoneKaffeesatzRegular', Arial, sans-serif;
font-family:"Myriad Pro",georgia, helvetica, arial, sans serif;
*/
font-size:larger;
background:black; color:white; margin-left:300px; width:500px; padding:20px}
a {color:yellow; background:black;}
a:hover {color:black; background:yellow;}