Skip to content

Instantly share code, notes, and snippets.

View link82's full-sized avatar

Davide Cenzi link82

  • Crunchy Bytes
  • Italy
View GitHub Profile
@link82
link82 / es.sh
Last active August 29, 2015 14:07 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@link82
link82 / Album.m
Created July 4, 2012 19:48
Nested object collection mapping
//
// Album.m
// NeedleMusic
//
// Created by Davide Cenzi on 13/05/12.
// Copyright (c) 2012 No1. All rights reserved.
//
#import "Album.h"
#import "Song.h"
@link82
link82 / output
Created July 4, 2012 21:43
Serialization output
2012-07-04 23:38:29.435 Needle[1314:12803] T restkit.object_mapping:RKObjectMappingOperation.m:435 Performing nested object mapping using mapping RKObjectKeyPathMapping: songs => songs for data: <Song: 0x8997690>
2012-07-04 23:38:29.435 Needle[1314:12803] D restkit.object_mapping:RKObjectMappingOperation.m:636 Starting mapping operation...
2012-07-04 23:38:29.436 Needle[1314:12803] T restkit.object_mapping:RKObjectMappingOperation.m:637 Performing mapping operation: RKObjectMappingOperation for 'Song' object. Mapping values from object <Song: 0x8997690> to object <Song: 0x89990e0> with object mapping <RKObjectMapping:0x7e84230 objectClass=Song keyPath mappings => (
"RKObjectKeyPathMapping: source => source",
"RKObjectKeyPathMapping: album_id => album_id",
"RKObjectKeyPathMapping: track_name => track_name",
"RKObjectKeyPathMapping: disc_number => disc_number",
"RKObjectKeyPathMapping: track_number => track_number"
)>
2012-07-04 23:38:29.496 Needle[1314:12803] T restkit.object_mapping:RKObje
@link82
link82 / Product and attachments mapping
Last active December 10, 2015 01:49
Restkit mapping errors
2012-12-23 13:05:32.567 RCGroup[2109:1ad03] T restkit.object_mapping:RKObjectMappingOperation.m:656 Performing mapping operation: RKObjectMappingOperation for 'Attachment' object. Mapping values from object {
attachment = (
{
icon = "http://www.website.com/download/1.gif";
id = 1;
level = 1;
"product_id" = 2;
title = "Scheda Tecnica";
type = pdf;
url = "http://www.website.com/download/1.pdf";
@link82
link82 / app_models_device.rb
Created April 11, 2013 21:09
I'm playing with rspec and factory girl but I'm stuck with a validation error for duplicate device entries while testing even if it should create different apps and devices for every test
class Device < ActiveRecord::Base
attr_accessible :app_id, :app_version, :locale, :push_token, :uid, :alias
belongs_to :app
validates_presence_of :app
validates :push_token,
:presence => true, :uniqueness => {:scope => :app_id, :message => 'already registered'}
require 'rubygems'
require 'active_record'
require 'yaml'
require 'logger'
require 'fileutils'
require 'aws/s3'
ROOT = File.expand_path(File.dirname(__FILE__))
CONFIG = YAML.load_file(File.join(ROOT, "config", "database.yml"))
TMP_BACKUP = File.join(ROOT, "tmp", "backup")
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
return self;
}