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
import flash.events.Event; | |
import flash.net.URLLoader; | |
var XML_URL:String = "http://yourdomainwithxml/"; | |
var myLoader:URLLoader; | |
var myXML:XML = new XML(); | |
function xmlLoaded(event:Event):void | |
{ | |
myXML = XML(myLoader.data); |
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
next_frame_button.addEventListener(MouseEvent.CLICK, go_to_next_frame); | |
function go_to_next_frame(event:MouseEvent):void | |
{ | |
nextFrame(); | |
} |
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 Location < ActiveRecord::Base | |
has_many :bids | |
def accepted_bids | |
bids.merge(Bid.accepted) | |
end | |
end | |
class Bid < ActiveRecord::Base | |
belongs_to :location |
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 mapper(date) | |
if date.last_day_of_month? | |
date..31 | |
else | |
date | |
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
module VirtualDate | |
extend ActiveSupport::Concern | |
class_methods do | |
def virtual_date(name) | |
attr_reader name | |
# Incoming forms pass dates as a hash like {1 => 2014, 2 => 4, 3 => 30} | |
# This converts that to a date class instance | |
define_method("#{name}=") do |new_value| |
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
# Below is a complex example of using yielding methods to make a nice interface to use. As you | |
# can see in RankList#fill!, we don't need to care or check if the location really is empty. | |
# We also don't need to do the calculation to find the next location to insert at. We can | |
# iterate through each available location until we reach the end. A cool side effect is that | |
# we can use any of the enumerable methods on the returned enumerator from #fill_locations | |
# such as printing the positions of all of the empty spaces by doing: | |
# p alignment_strategy.fill_locations(@the_grid).to_a | |
module AlignmentStrategy | |
class Left |
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 MyMiddleware | |
def initialize(app) | |
@app = app | |
@message = message | |
end | |
def call(env) | |
dup._call(env) | |
end |
OlderNewer