This file contains hidden or 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
function copyIntoClipboard(text) { | |
var flashId = 'flashId-HKxmj5'; | |
/* Replace this with your clipboard.swf location */ | |
//var clipboardSWF = 'http://appengine.bravo9.com/copy-into-clipboard/clipboard.swf'; | |
var clipboardSWF = '/clipboard.swf'; | |
if(!document.getElementById(flashId)) { | |
var div = document.createElement('div'); |
This file contains hidden or 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
This is an example of using RVM's Project .rvmrc file | |
to have it automatically bootstrap your environment, including bundler. | |
This could be further expanded to do anything you require :) | |
The important thing to remember is that the purpose of these files is | |
to allow you to very easily have your 'project context' (aka 'environment') | |
loaded automatically for you when you enter the project in the shell (cd). |
This file contains hidden or 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 'machinist/datamapper' | |
# Let's say we have some really simple models for a blog. (I'm using | |
# DataMapper here, but Machinist works exactly the same way with ActiveRecord.) | |
class Person | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, String | |
end |
This file contains hidden or 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
AK,61.3850,-152.2683 | |
AL,32.7990,-86.8073 | |
AR,34.9513,-92.3809 | |
AS,14.2417,-170.7197 | |
AZ,33.7712,-111.3877 | |
CA,36.1700,-119.7462 | |
CO,39.0646,-105.3272 | |
CT,41.5834,-72.7622 | |
DC,38.8964,-77.0262 | |
DE,39.3498,-75.5148 |
This file contains hidden or 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
<!-- Worse than RJS --> | |
= link_to_function("Add widget", :class => "new-widget", :id => "add_link") do |page| | |
- page << %Q{$(this).after('#{escape_javascript render(:partial => 'form', :object => Widget.new, :locals => { :thing => @thing, :that => @that})}').next().show();$(this).siblings('.no-information').remove(); return false;} |
This file contains hidden or 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
# For "Classic" style/top-level type of apps do something like: | |
# | |
# configure :development do | |
# require File.join(File.dirname(__FILE__), 'sinatra_reloader') | |
# set :reload_paths, [File.join(File.dirname(__FILE__), '**', '*.rb')] | |
# end | |
# | |
# For "Modular" style/Sinatra::Base subclasses: | |
# | |
# configure :development do |
This file contains hidden or 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
class Commit | |
attr_reader :id | |
lazy_reader :parents | |
lazy_reader :tree | |
lazy_reader :author | |
lazy_reader :authored_date | |
lazy_reader :committer | |
lazy_reader :committed_date | |
lazy_reader :message | |
lazy_reader :short_message |
This file contains hidden or 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
jQuery.easing['jswing'] = jQuery.easing['swing']; | |
jQuery.extend(jQuery.easing, { | |
def: 'easeOutQuad', | |
swing: function (x, t, b, c, d) { | |
return jQuery.easing[jQuery.easing.def](x, t, b, c, d); | |
}, | |
easeInQuad: function (x, t, b, c, d) { | |
return c * (t /= d) * t + b; | |
}, |
This file contains hidden or 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
"The secret to Ruby's success is its use of "convention over configuration," wherein naming a variable foo causes the corresponding column in the database to automatically be named foo as well." | |
http://infoworld.com/d/developer-world/7-programming-languages-the-rise-620?page=0,1 |
This file contains hidden or 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
# | |
# Super tiny block configuration class, which is | |
# a great example of nested instance evaluation. | |
# All using a single class. | |
# | |
# Inspired by ... | |
# http://github.com/ahoward/configuration/blob/master/lib/configuration.rb | |
# | |
# Updated: More functionality, less lines of code (gem soon) | |
# |