Skip to content

Instantly share code, notes, and snippets.

class RegisterController < ApplicationController
def create
render json: UserService.new.register(registration_params)
rescue RegistrationError
render json: {message: 'User already registered'}, status_code: 422
end
private
def registration_params
get 'companies' => 'company#index'
namespace :webhooks do
post 'company_market_updates' => 'company_market_updates#update'
end
class CompanyController < ApplicationController
def index
render json: Company.all,
serializer: ActiveModel::Serializer::CollectionSerializer,
each_serializer: CompanySerializer
end
end
class Company < Model
attribute :stock_symbol, type: String
attribute :name, type: String
attribute :stock_price, type: Float
attribute :stock_volume, type: Integer
attribute :number_of_shares, type: Integer
has_one :ceo, class_name: 'Person'
def volume_price
{
"characters": [{
"name": "Itxa",
"realm": "Outland",
"battlegroup": "Misery",
"class": 8,
"race": 7,
"gender": 1,
"level": 0,
"achievementPoints": 0,

How to iOS

Dear iOS Developer,

These are the things you might take into account when developing rock-solid iOS apps.

Writing better code makes you happy and will make your employer, teammates, and even customers happier in the mid-long term.

Please remember

@perezpaya
perezpaya / .vimrc
Created December 10, 2014 12:34
Vimerinos
set nocompatible " be iMproved, requires
set shell=/bin/bash
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@perezpaya
perezpaya / sublime_config
Created October 8, 2014 08:15
Sublime Config
{
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"ignored_packages":
[
"JSLint",
"Vintage",
"JSHint"
],
"rulers":
[
#! /usr/bin/sh
echo 'Becareful, this script is installing the latest version of nodejs'
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
node -v
sudo echo "deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi" >> /etc/apt/sources.list
sudo echo "deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi" >> /etc/apt/sources.list