Skip to content

Instantly share code, notes, and snippets.

@pieterjongsma
pieterjongsma / ParabolicFitTest.h
Created July 27, 2012 11:37
Parabolic Fit Test Header
#import <Foundation/Foundation.h>
@interface ParabolicFitTest : NSObject
@property (nonatomic) NSInteger repetitions;
- (void)runBatch;
- (void)runSingle;
@pieterjongsma
pieterjongsma / ParabolicFitTest.m
Created July 27, 2012 11:38
Parabolic Fit Test
#import "ParabolicFitTest.h"
@interface ParabolicFitTest ()
- (NSInteger)functionOne:(NSInteger)index;
- (NSInteger)functionTwo:(NSInteger)index;
@end
@pieterjongsma
pieterjongsma / main.m
Created July 27, 2012 11:47
Parabolic Fit Test main
#import <Foundation/Foundation.h>
#import "ParabolicFitTest.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
ParabolicFitTest *testCase = [[ParabolicFitTest alloc] init];
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);
},
//
// 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');
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
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
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
- @events.each do |event|
%ul
- event.attending_friends_for_user(current_user).each do |friend|
%li= friend.name
class EventsFeed
include Enumerable
delegate :each, :<<, to: :events
def initialize(events:, user:)
@events = events
@user = user
end
def events