This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'dynect_rest' | |
#config.rb contains config values. example: | |
# ACCOUNT = "demo-demo" | |
# USER = "demo" | |
# PASS = "demo" | |
# SOACONTACT = "admin.demo" | |
require 'config.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# | |
## Copyright (C) 2009 Gleb Voronich <http://stanly.net.ua/>, 2010 Chris Kelly <http://ckdake.com/> | |
## | |
## This program is free software; you can redistribute it and/or | |
## modify it under the terms of the GNU General Public License | |
## as published by the Free Software Foundation; version 2 dated June, | |
## 1991. | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rest-client' | |
gem 'json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'oauth' | |
gem 'twitter', :git => 'git://github.com/jnunemaker/twitter.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copyright 2002 Chris Kelly [email protected] | |
main: | |
.data | |
str1: .asciiz "What are these?\n" | |
brk: .asciiz "\n" | |
start: .byte 0 | |
.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DeviseHelper | |
def devise_error_messages! | |
unless resource.errors.empty? | |
content_tag :div, :id => "error_explanation", :escape => false do | |
content_tag(:h2, "The following errors were encountered:") + | |
content_tag(:ul, resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join.html_safe) | |
end.html_safe | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Addon for classes using https://github.com/stefankroes/ancestry | |
# Create the full tree for this root/parent/child if it doesnt yet exist | |
# .save! is required to generate ancestry fields so that .children works | |
def self.find_or_create_tree_by_name(root_name = nil, parent_name = nil, child_name = nil) | |
if root_name.present? | |
root = self.find_or_create_by_name(root_name) | |
root.save! | |
if parent_name.present? | |
parent = root.children.find_or_create_by_name(parent_name) | |
parent.save! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Form dirtyness tracking | |
$('form *').change( function() { | |
window.formDirty = true; | |
}); | |
$('form input').click( function() { | |
if (this.name == "commit") { | |
window.formDirty = false; | |
} | |
}); | |
window.onbeforeunload = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Ancestry | |
# https://github.com/stefankroes/ancestry | |
module InstanceMethods | |
# Clone an object and all children | |
# => replacing values with those from attributes if present | |
# => setting parent to new parent if present | |
# => setting the "original_id_field_name" if present to the id of the original object | |
# | |
# Example use_case: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p0 adella:benchmarks$ ruby -v | |
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0] | |
ruby-1.9.2-p0 adella:benchmarks$ php -v | |
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55) | |
Copyright (c) 1997-2010 The PHP Group | |
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies | |
ruby-1.9.2-p0 adella:benchmarks$ cat foo.rb | |
msg = "Hello world" |
OlderNewer