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 <Foundation/Foundation.h> | |
@interface ParabolicFitTest : NSObject | |
@property (nonatomic) NSInteger repetitions; | |
- (void)runBatch; | |
- (void)runSingle; |
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 "ParabolicFitTest.h" | |
@interface ParabolicFitTest () | |
- (NSInteger)functionOne:(NSInteger)index; | |
- (NSInteger)functionTwo:(NSInteger)index; | |
@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
#import <Foundation/Foundation.h> | |
#import "ParabolicFitTest.h" | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
ParabolicFitTest *testCase = [[ParabolicFitTest alloc] init]; |
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
var get = Ember.get, set = Ember.set; | |
Ember.HashExclamationLocation = Ember.Object.extend({ | |
init: function() { | |
set(this, 'location', get(this, 'location') || window.location); | |
}, | |
getURL: function() { | |
return get(this, 'location').hash.substr(2); | |
}, |
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
// | |
// ember_to_static.js | |
// | |
// This script takes a URL as argument. (In that order!) | |
// The script then runs the Javascript on this page and waits until Ember has finished loading. | |
// It then renders the resulting static HTML page to the console. | |
// | |
var fs = require('fs'); | |
var system = require('system'); |
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 | |
protect_from_forgery | |
before_filter :catch_escaped_fragment | |
protected | |
def catch_escaped_fragment | |
if fragment = params[:_escaped_fragment_] | |
# Build the original url |
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 User | |
has_many :friendships | |
has_many :friends, through: :friendships | |
has_many :attendances | |
has_many :events, through: :attendances | |
end | |
class Event | |
has_many :attendances | |
has_many :attendees, through: :attendances, source: :user |
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 Event | |
def attending_friends_for_user(user) | |
attendees.friends_for(user) | |
end | |
end | |
class User | |
scope :friends_for, -> (user) { includes(:friendships).where(friendships: { friend_id: user.id }) } | |
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
- @events.each do |event| | |
%ul | |
- event.attending_friends_for_user(current_user).each do |friend| | |
%li= friend.name |
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 EventsFeed | |
include Enumerable | |
delegate :each, :<<, to: :events | |
def initialize(events:, user:) | |
@events = events | |
@user = user | |
end | |
def events |
OlderNewer