- git clone https://github.com/jgnatch/angular-on-cuba.git
- Redis
- Mac:
brew install redis
- Ubuntu:
sudo apt-get install redis-server
- Mac:
- Postman
- Gemas: (Se pueden instalar con
dep install
obundle install
desde el repo)- cuba -v 3.3.0
- ohm -v 2.0.1
- ohm-contrib -v 2.0.0
This file contains 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
Cuba.define do | |
on "posts" do | |
run Posts | |
end | |
end | |
class Posts < Cuba | |
define do | |
on ":id" do |id| | |
post = Post[id] |
This file contains 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
Building native extensions. This could take a while... | |
ERROR: Error installing patron: | |
ERROR: Failed to build gem native extension. | |
/usr/local/rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb | |
checking for curl-config... yes | |
checking for rb_thread_blocking_region()... yes | |
creating Makefile | |
make |
This file contains 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
# http://tech.natemurray.com/2007/03/custom-yaml-emitter.html | |
require 'psych' | |
require 'yaml' | |
require 'gsl' | |
v = GSL::Vector.alloc 1..10 | |
class GSL::Vector |
This file contains 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
# config/unicorn.rb | |
worker_processes 4 | |
timeout 30 | |
preload_app true | |
before_fork do |server, worker| | |
# Replace with your ORM of choice | |
if defined?(ActiveRecord::Base) | |
ActiveRecord::Base.connection.disconnect! |
This file contains 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
class EmailWorker | |
include SuckerPunch::Worker | |
def perform(user_id) | |
ActiveRecord::Base.connection_pool.with_connection do | |
user = User.find(user_id) | |
UserMailer.welcome(user).deliver | |
end | |
end |
This file contains 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 'spec_helper' | |
# it's important to add the ':worker => true' setting so tests don't run in a transaction. This is configured in spec_helper | |
describe EmailWorker, :worker => true do | |
before(:each) do | |
@user = FactoryGirl.create :user | |
end | |
let(:worker){ EmailWorker.new } |
This file contains 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
class ProductsController < ApplicationController | |
def preview | |
begin | |
ActiveRecord::Base.transaction do | |
if request.referer =~ %r{/admin/products/(.+)/edit} | |
@product = Product.find($1) | |
@product.update_attributes(params[:product]) | |
else | |
@product = Product.new(params[:product]) | |
raise "Invalid" unless @product.valid? |
This file contains 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
#!/bin/sh | |
# | |
# A hook script to remind us to precompile the assets. | |
color='\033[0;35m' | |
NC='\033[0m' # No Color | |
changes=$(git diff --name-only HEAD^) |
This file contains 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
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Taken from https://dev.to/thiht/shell-scripts-matter | |
#/ Usage: | |
#/ Description: | |
#/ Examples: | |
#/ Options: |
OlderNewer