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
has_attached_file :video, | |
:url => ":class/:id/:style/:basename.:extension", | |
:path => ":class/:id/:style/:basename.:extension", | |
:storage => :s3 # this is redundant if you are using S3 for all your storage requirements | |
validates_attachment_presence :video | |
has_attached_file :thumbnail, :styles => {:thumb => "162x161#"} # adjust the thumb style as needed |
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
LEGEND: * (layout) ! (interior) | |
application_layout | |
header * | |
left menu * | |
search | |
flash messages * | |
right content box (what height?) ! | |
footer * |
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
<? | |
$response = file_get_contents("http://elections.raisethehammer.org/api/election/1"); | |
$decoded = json_decode($response); // requires PHP >= 5.2.0 | |
?> | |
<? foreach($decoded->candidates as $candidate): ?> | |
<?= $candidate->name ?><br /> | |
<? endforeach; ?> |
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' | |
def pay(bet) | |
URI.parse('http://roulette.engineyard.com').read =~ /13/ ? bet * 35 : 0 | |
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
def pay(bet) | |
`curl -s http://roulette.engineyard.com` =~ /13/ ? bet * 35 : 0 | |
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
# IN ENVIRONMENT.RB, ADD THESE LINES AFTER THE BOOT SECTION AND BEFORE THE INITIALIZER BLOCK | |
# (e.g. on line 13 of most environment.rb's): | |
if Gem::VERSION >= "1.3.6" | |
module Rails | |
class GemDependency | |
def requirement | |
r = super | |
(r == Gem::Requirement.default) ? nil : r | |
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
module Forge | |
require 'forge/settings' | |
require 'forge/credit_card_processor' | |
@@settings = YAML::load(File.open(Rails.root + 'config/settings.yml')).recursive_symbolize_keys! | |
def self.settings | |
@@settings | |
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
class Lead | |
state = "in-progress" | |
end | |
# OR | |
class Lead | |
constructor: -> | |
super |
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
- (void) handleDataFromRemoteOrigin:(id)data | |
{ | |
NSString *content; | |
*content = [data valueForKeyPath:@"content"]; | |
} |
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
# in the view | |
= form_for([:forge, @job, job_application], :remote => true) do |f| | |
# in the JS header portion of the view | |
$("form").on("ajax:success", function(data, status, xhr) { | |
alert("Success"); | |
}); |