Skip to content

Instantly share code, notes, and snippets.

View maceto's full-sized avatar
🏠
Working from home

Martin Aceto maceto

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am maceto on github.
  • I am maceto (https://keybase.io/maceto) on keybase.
  • I have a public key ASD68mgabT_RewKud5ml_mR26sj9fFG8co-rXV7vG2d00go

To claim this, I am signing this object:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
your-api
SAM Template for your API
Globals:
Api:
Cors:
@maceto
maceto / count.rb
Last active September 3, 2015 01:42
Benchmark on MongoDB with ORM MongoID
require 'benchmark/ips'
# Counting of records with ORM or directly on MongoDB
#
# IncomingCall.where(:created_at.gte =>(Date.today-30)).count
#
# VS
#
# db[:incoming_calls].aggregate([
# { "$match": { created_at: {"$gte": (Date.today-30)} } },
require 'rake/testtask'
task default: 'test:all'
namespace :test do
Rake::TestTask.new(:all) do |t|
t.pattern = "test/**/*_spec.rb"
t.verbose = true
end
@maceto
maceto / unicorn.sh
Created September 25, 2012 22:06
unicorn.sh
#!/bin/sh
set -e
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/var/www/apps/senddinero-im/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
AS_USER=senddineroim
set -u
@maceto
maceto / street_test.rb
Created March 22, 2012 18:02
minitest validates presence true
require "minitest_helper"
describe Street do
it "must have a code" do
# No code
street = Street.new
# Invalid
street.valid?.must_equal false
# Code assignation (random 1000/10000)
street.code = rand(9000) + 1000
class TransactionRequest
def initializer(app)
@app = app
@regex = /Regex/
end
def call(env)
if @regex.test env['REQUEST_URI']
#proceso la transacción
Cuba.define do
@message=""
# only GET requests
on get do
# /
on "" do
@players = Player.all(:order => [ :name.desc ])
res.write render('views/index.haml')
end
end
require "cuba/test"
scope do
test "load Homepage" do
visit "/"
assert has_content?("contenido")
end
end