Skip to content

Instantly share code, notes, and snippets.

View zaneclaes's full-sized avatar

Zane Claes zaneclaes

View GitHub Profile
@zaneclaes
zaneclaes / gist:7965245
Created December 14, 2013 21:39
Basic sprite masking
- (void)visit {
if(self.mask) {
self.bakedTexture = [CCRenderTexture renderTextureWithWidth:self.contentSize.width
height:self.contentSize.height];
self.bakedTexture.position = ccp(self.contentSize.width/2,self.contentSize.height/2);
[self.mask setBlendFunc:(ccBlendFunc){GL_ONE, GL_ZERO}];
[self.bakedTexture begin];
[self.mask visit];
for(CCSprite *sprite in self.assets) {
def self.get_by_id(id, current_user)
binding.pry # ID is 1
begin
trip_invoice = TripInvoice.find(id)
rescue
raise ServiceModelBase::RecordNotFoundError
end
raise ServiceModelBase::NotAuthorizedError unless self.has_access?(trip_invoice, current_user)
//
// AMProgressSpinnerComponent.m
// AftermathCore
//
// Created by Zane Claes on 8/29/13.
// Copyright (c) 2013 inZania LLC. All rights reserved.
//
#import "AMProgressSpinnerComponent.h"
#import "AMAssetManager.h"
NSDictionary *params = @{@"offset" : (offset) ? @(offset) : @0,
@"items_per_page" : (limit) ? @(limit) : @50,
@"role" : host ? @"host" : @"guest",
@"include_pending" : includePending ? @"true" : @"false",
@"include_checkpoint" : includeCheckpoint ? @"true" : @"false",
@"_format" : @"with_invoice_short"
};
[[BBAPI V1] get:@"/reservations" withParams:params onSuccess:successBlock onFailure:failureBlock];
invoice_items = @trip_invoice.trip_invoice.trip_invoice_items.map do |item|
item.trip_product = TripProduct.find_by_id(item.trip_product_id)
item
end
module Api
module V2
class TripInvoicesPresenter < BasePresenter
def initialize(trip_invoice, current_user)
@trip_invoice = trip_invoice
@current_user = current_user
end
def to_json_default
invoice_items = @trip_invoice.trip_invoice.trip_invoice_items.map do |item|
module Api
module V2
class TripInvoicesPresenter < BasePresenter
def initialize(trip_invoice, current_user)
@trip_invoice = trip_invoice
@current_user = current_user
end
def to_json_default
invoice_items = @trip_invoice.trip_invoice.trip_invoice_items.map do |item|
NSNumber *limitParam = (limit) ? @(limit) : @50;
NSNumber *offsetParam = (offset) ? @(offset) : @0;
NSDictionary *params = @{@"_format": @"v1_legacy",
(host ? @"host_id" : @"guest_id") : [BBUser activeUser].userId ?: @(0),
@"offset" : offsetParam,
@"items_per_page" : limitParam,
@"include_pending" : includePending ? @"true" : @"false",
@"include_checkpoint" : includeCheckpoint ? @"true" : @"false"
};
- (void)choosePaymentInstrument:(BBPaymentInstrument*)instrument {
NSAssert(instrument.paymentInstrumentId, @"instrument must have an ID");
NSString *endpoint = [NSString stringWithFormat:@"/trip_invoices/%d",(int)self.tripInvoice.tripInvoiceId.integerValue];
NSDictionary *params = @{@"op":@"add",@"path":@"/payment_instrument_id",@"value":instrument.paymentInstrumentId};
[self showLoadingView:NO blocking:NO];
[[BBAPI V2] patch:endpoint withParams:params onSuccess:^(id object) {
[self dismissLoadingView];
[self.tableView triggerPullToRefresh];
} onFailure:^(NSError *e) {
//
// SNFirebase.m
// SharedNotes
//
// Created by Zane Claes on 4/12/14.
// Copyright (c) 2014 inZania LLC. All rights reserved.
//
#import "SNFirebase.h"
#import <Firebase/Firebase.h>