This file contains hidden or 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 'api_version' | |
Securus::Application.routes.draw do | |
match "/bb_poc" => "bb_poc#index" | |
scope "(:locale)", :locale => /ar|de|en|fr|it|nl|sr/ do | |
resource :session, :only => [:new, :create, :destroy] | |
resource :profile, :only => [:show, :edit, :update] | |
resources :users, :only => [:new, :create] do |
This file contains hidden or 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 'net/http/post/multipart' | |
def file=(_file) | |
url = URI.parse(<Your endpoint>) | |
File.open(_file) do |f| | |
req = Net::HTTP::Post::Multipart.new url.path, "file" => UploadIO.new(f, "image/jpeg", "filename") | |
res = Net::HTTP.start(url.host, url.port) do |http| | |
http.request(req) | |
end | |
end |
This file contains hidden or 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)viewWillAppear:(BOOL)animated{ | |
[super viewWillAppear:animated]; | |
__block UIView *searchLabel = [self.filterScrollingView viewWithTag:kSearchLabel]; | |
[UIView animateWithDuration:15. delay:0. options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear) animations:^{ | |
searchLabel.center = CGPointMake(-searchLabel.bounds.size.width / 2, searchLabel.center.y); | |
} completion:nil]; | |
} |
This file contains hidden or 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
{ | |
name : "Cams custom view", | |
columns : [ | |
"name", "hits", "created_at" | |
], | |
filters : [ | |
{action : "name='Cam'"}, | |
{action : "hits>12"} | |
], | |
order : [{action : "hits DESC"}, {action : "created_at DESC"}] |
This file contains hidden or 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
@timeline.map do |post| | |
{ | |
:id => post.id, | |
:brand => { | |
:id => post.brand.id, | |
:name => post.brand.name, | |
:updated_at => post.brand.updated_at, | |
:attachments => post.brand.images.map do |image| | |
{ | |
:id => image.id, |
This file contains hidden or 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 Attachments | |
def attachments | |
images.map do | |
{ | |
:id => id, | |
:styles => styles, | |
:endpoint => endpoint, | |
} | |
end |
This file contains hidden or 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
//An attachment representation | |
{ | |
"id" : 4 | |
"endpont" : "http://s3.amazonaws.com/sns-bucket/production/images/" | |
"file" : "file.png", | |
"styles" : [ | |
{"name" : "icon"}, | |
{"name" : "small"}, | |
{"name" : "small@2x"} |
This file contains hidden or 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
[ | |
{ | |
"id":2504, | |
"brand": { | |
"name" : "20000000 fragments", | |
"images" : { | |
"style":"icon", | |
"url":"http://s3.amazonaws.com/sns-bucket/production/images/4/icon/file.png?1310604103", | |
"updated_at":"2011-07-14T00:41:44Z", | |
} |
This file contains hidden or 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
RKManagedObjectMapping *postMapping = [RKManagedObjectMapping mappingForEntityWithName:@"MRNPost"]; | |
postMapping.primaryKeyAttribute = @"postID"; | |
[postMapping mapKeyPath:@"id" toAttribute:@"postID"]; | |
[postMapping mapKeyPath:@"url" toAttribute:@"url"]; | |
[postMapping mapKeyPath:@"content" toAttribute:@"content"]; | |
[postMapping mapKeyPath:@"created_at" toAttribute:@"createdAt"]; | |
[postMapping mapKeyPath:@"updated_at" toAttribute:@"updatedAt"]; | |
[postMapping mapKeyPath:@"images" toRelationship:@"images" withObjectMapping:postImageMapping]; |
This file contains hidden or 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
"images" : [ | |
{ | |
"id":4, | |
"updated_at" : "2011-07-14T00:41:44Z", | |
"attachments": [ | |
{ | |
"style" : "icon", | |
"url" : "http://s3.amazonaws.com/sns-bucket/production/images/4/icon/file.png" | |
}, | |
{ |