This is a list of service providers that will help you do better open source software
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 'open-uri' | |
check_every = 4 # seconds | |
url = "http://store.apple.com/us" | |
check_again = true | |
print "Checking #{url}: " | |
while check_again | |
begin |
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 MessageType | |
MMS = "mms" | |
SMS = "sms" | |
end | |
class MessageType | |
VALID_TYPES = [:sms, :mms] | |
class << self | |
def method_missing(method, *args, &block) |
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 Gateway | |
UNWIRE = 'unwire' | |
FOO = 'foo' | |
BAR = 'bar' | |
class << self | |
def all | |
[UNWIRE, FOO, BAR] | |
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
require 'sketchup' | |
module MyPlugin | |
class Helper | |
class << self | |
LENGTH_TEXT_SYMBOL_DICT = { | |
:inches => '"', | |
:feet => "'", | |
:millimeters => "mm", | |
:centimeters => "cm", |
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
def show | |
@work_process = @project.work_processes.find(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.xml { render :xml => @work_process.to_xml(:include => [:project, | |
:companies, | |
:equipment, | |
:inspections, | |
:material_packages, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>HTML5 Audio Demo</title> | |
</head> | |
<body> | |
<h1>HTML5 Audio Demo</h1> | |
<audio controls preload="auto" autobuffer> | |
<source src="http://www.vorbis.com/music/Epoq-Lepidoptera.ogg" /> | |
<source src="http://zack1.e-technik.tu-ilmenau.de/%7Edoering/mdstudio/stingray/Stingray.mp3" /> |
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
class ApplicationController < ActionController::Base | |
private | |
def fix_nested_attribute_structure(data = nil, model = nil) | |
unless data | |
# guess data based on current controller | |
data = params[self.class.to_s.sub('Controller', '').singularize.underscore.to_sym] | |
end | |
unless model | |
# guess model based on current controller |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script src="/javascripts/s3_upload.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var s3_swf_1_object = s3_swf_init('s3_swf_1', { buttonWidth: 100, | |
buttonHeight: 30, | |
buttonUpPath: '/flash/s3_up_button.gif', |
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
class FileResource < ActiveRecord::Base | |
has_attached_file :attachment, | |
:storage => :s3, | |
:bucket => ENV['S3_BUCKET'], | |
:s3_credentials => { :access_key_id => ENV['S3_KEY'], | |
:secret_access_key => ENV['S3_SECRET'] }, | |
:path => 'files/:id/:filename', | |
:url => '/files/:id/:filename' | |