Skip to content

Instantly share code, notes, and snippets.

@t2-support-gists
t2-support-gists / First.rb
Created September 14, 2012 18:08
CMS Ruby RESTFul App 1
# Utility method for saying individual characters in a string
sayNumber = lambda { |text|
if text.nil? then
say "Please enter a valid number"
else
text.split("").each do |c|
say c
end
end
}
@mattpodwysocki
mattpodwysocki / jsconf-eu-2011.md
Created October 1, 2011 13:40
JSConf.EU Slides
@tbranyen
tbranyen / breakfast.js
Created September 8, 2011 03:04
basic module function
(function(self) {
self.Model = Backbone.Model.extend({
defaults: {
beverage: 'Orange Soda',
yogurt: false,
fruits: ['Apple', 'Plum', 'Watermelon']
}
});
@justjohn
justjohn / jquery-mobile-red-buttons.css
Created July 1, 2011 04:03
Red button CSS for JQuery Mobile
/* Red button theme for JQuery Mobile
* - Use data-theme="r" for red versions of the default JQuery Mobile Buttons.
******************************************************************************************/
.ui-btn-up-r {
border: 1px solid #721414;
background: #AB2525;
font-weight: bold;
color: #fff;
text-shadow: 0 -1px 1px #000;
@mkristian
mkristian / Error compiling asset application.js
Created June 10, 2011 12:59
rails-3.1.0.rcX with jruby
[INFO] Error compiling asset application.js:
[INFO] NameError: uninitialized constant JavaLang
[INFO] (in /home/kristian/projects/sandbox/rails3.1/rails3.1-ar-rc4/app/assets/javascripts/users.js.coffee)
[INFO] Served asset /application.js - 500 Internal Server Error
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@casualjim
casualjim / server.rb
Created January 12, 2011 07:12
A jruby jetty launcher for an exploded war
description "ConnFu demo application"
start on runlevel [2345]
stop on runlevel [!2345]
console none
# the following ensures that the process is restarted when it should die unexpectedly
respawn
exec sudo -u randomuser -H bash -c "cd /home/randomuser/connfu-demo; PORT=14080 /home/randomuser/.rvm/rubies/jruby-1.5.6/bin/ruby -J-Xmx256m -J-Xms128m -J-Xmn64m --server --headless connfu-demo-server"