Skip to content

Instantly share code, notes, and snippets.

@noeticpenguin
noeticpenguin / setup_notes.md
Created September 6, 2011 20:55
My default 3.1 rails setup

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

source 'http://rubygems.org'

gem 'rails', '3.1.0'

gem 'sqlite3'

@noeticpenguin
noeticpenguin / gist:1242452
Created September 26, 2011 15:09 — forked from ndbroadbent/gist:1218804
ruby1.9.2-p290 w/ Require performance patch.
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > /tmp/ruby-1.9.2p290.patch
rvm install ruby-1.9.2-p290 --patch /tmp/ruby-1.9.2p290.patch
@noeticpenguin
noeticpenguin / sfdc_utilities.rb
Created October 6, 2011 21:07
Salesforce 15 to 18 digit guid conversion
def convert_guid(short_guid)
chunks = short_guid.chars.to_a
char_map = %w{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5}
extension = []
chunks.each_slice(5) { |x| y = x.reverse.map {|c| (c.match /[A-Z]/) ? 1 : 0 }.join("").to_i(2) ; extension << y}
short_guid + (extension.map {|e| char_map.at(e)}).join("").to_s
end
@noeticpenguin
noeticpenguin / TestDemoWebCallout.java
Created October 19, 2011 18:48
Writing and testing restful web callouts from Salesforce.com
@isTest
private class TestDemoWebCallout {
static testMethod void testRestfulCallout() {
Lead l = new Lead();
l.Status = 'Open';
l.LastName = 'Owen';
l.FirstName = 'Bob';
l.Street = '1234 Sesame Street';
l.City = 'Houston';
@noeticpenguin
noeticpenguin / gist:1428039
Created December 3, 2011 20:20 — forked from jonathanpenn/gist:1428002
Blip prompt
# Prompt Setup
YELLOW='\[\033[1;33m\]'
BLUE='\[\033[1;34m\]'
GREEN='\[\033[1;32m\]'
RED='\[\033[0;31m\]'
NORMAL='\[\033[00m\]'
WHITE='\[\033[0;37m\]'
function minutes_since_last_commit {
@noeticpenguin
noeticpenguin / mr_status_bar_app.rb
Created December 15, 2011 12:13 — forked from rubiojr/mr_status_bar_app.rb
MacRuby StatusBar Application
#
# Initialize the stuff
#
# We build the status bar item menu
def setupMenu
menu = NSMenu.new
menu.initWithTitle 'FooApp'
mi = NSMenuItem.new
mi.title = 'Hellow from MacRuby!'
mi.action = 'sayHello:'
@noeticpenguin
noeticpenguin / PaddedTextFieldCell.rb
Created January 1, 2012 23:07 — forked from micahbrich/PaddedTextFieldCell.rb
Awesome Text Fields in MacRuby
class PaddedTextFieldCell < NSTextFieldCell
def drawingRectForBounds(cellFrame)
super
result = cellFrame
padding_left = (result.size.width / 16).round # to make sure text is clear
padding_top = (result.size.height / 4).round
result.origin.x += padding_left
result.origin.y += padding_top
@noeticpenguin
noeticpenguin / Datastore.rb
Created January 30, 2012 22:10 — forked from cpowell/Datastore.rb
A singleton class to manage a MacRuby application's data storage requirements.
#
# Datastore.rb
# A singleton class to manage a MacRuby application's data storage requirements.
#
# Chris Powell, cpowell@prylis.com, http://cbpowell.wordpress.com
#
# This work is licensed under a Creative Commons Attribution 3.0 Unported License.
# http://creativecommons.org/licenses/by/3.0/
#
# For usage and discussion, see http://cbpowell.wordpress.com/category/macruby/
@noeticpenguin
noeticpenguin / ragios.rb
Created February 24, 2012 19:52 — forked from kivanio/ragios.rb
St. Ruby - A Ruby based Object Oriented System and Network Monitoring Tool
#!/usr/bin/ruby
#Title :Ragios (aka St. Ruby)
#Date :10/13/2010
#Author :Obi Akubue
#Version :0.3.3
#description: This is the framework for a Ruby Based System and Network Monitoring Tool
#this project is just an excuse to play with ruby and linux servers
require 'net/http'
<div class="dataTables_processing" style="visibility: visible; "><img src="/assets/ajax-loader.gif"></div>