Skip to content

Instantly share code, notes, and snippets.

View spastorino's full-sized avatar

Santiago Pastorino spastorino

View GitHub Profile
@spastorino
spastorino / discourse_ams_rewrite.patch
Last active April 9, 2017 20:31
This is the discourse patch to work with ActiveModel::Serializers rewrite branch
From 81489f460de836707689f235e27364e05a191f9f Mon Sep 17 00:00:00 2001
From: Santiago Pastorino <santiago@wyeworks.com>
Date: Thu, 9 Jan 2014 12:24:58 -0200
Subject: [PATCH] Use ActiveModel::Serializers 0.9.0.alpha1
---
Gemfile | 2 +-
Gemfile_rails4.lock | 6 +++---
app/models/discourse_version_check.rb | 4 +++-
app/serializers/application_serializer.rb | 9 ++++++++-
~ curl -s https://gist.github.com/lmarburger/6537333/raw/time.sh | bash
== Fastly ==
DNS: 0.520 CONNECT: 0.695 REQSENT: 2.299 STARTTX: 4.560 TOTAL: 7.163
X-Served-By: cache-v44-ASH
X-Cache: MISS
DNS: 0.001 CONNECT: 0.184 REQSENT: 0.571 STARTTX: 2.878 TOTAL: 5.633
X-Served-By: cache-v36-ASH, cache-ny57-NYC
X-Cache: MISS, MISS
require 'formula'
class Kindlegen < Formula
url 'http://kindlegen.s3.amazonaws.com/KindleGen_Mac_i386_v2_9.zip'
homepage 'http://www.amazon.com/gp/feature.html?docId=1000234621'
sha1 '851064ef18687edaf93abd781f9711a2cb293f7d'
version '2.9'
skip_clean 'bin'
@spastorino
spastorino / kindlegen.rb
Last active December 14, 2015 14:09 — forked from dch/kindlegen.rb
require 'formula'
class Kindlegen < Formula
url 'http://s3.amazonaws.com/kindlegen/KindleGen_Mac_i386_v2_8.zip'
homepage 'http://www.amazon.com/gp/feature.html?docId=1000234621'
sha1 '08207c7a283d9956a040d87e793f3c00ce66555f'
version '2.8'
skip_clean 'bin'
@spastorino
spastorino / vim.rb
Created July 8, 2012 17:11 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.591'
def features; %w(tiny small normal big huge) end
require 'action_controller/railtie'
class HelloController < ActionController::Metal
def world
self.response_body = 'Hello World!'
end
end
Rack::Handler::WEBrick.run HelloController.action(:world), :Port => 3000
require 'action_controller/railtie'
module Myapp
class Application < Rails::Application
config.secret_token = 'd38ad04f101b78570a76ecd1d4664e2b'
routes.append do
get '/' => 'myapp/hello#world'
end
end
diff --git a/test/context_test.rb b/test/context_test.rb
index 36e7022..aefe2b9 100644
--- a/test/context_test.rb
+++ b/test/context_test.rb
@@ -913,4 +913,19 @@ describe 'Rack::Cache::Context' do
response.body.should.equal 'Hello World'
cache.trace.should.include :pass
end
+
+ it 'logs to rack.logger if available' do
require 'thread'
mutex = Mutex.new
i = 0
t1 = Thread.new do
1_000_000.times do
mutex.synchronize do
i += 1
end
@spastorino
spastorino / gist:1182590
Created August 31, 2011 01:22
rails.log
➜ dist gem install *
Successfully installed activesupport-3.1.0
Successfully installed activemodel-3.1.0
Successfully installed actionpack-3.1.0
Successfully installed actionmailer-3.1.0
Successfully installed actionpack-3.1.0
Successfully installed activemodel-3.1.0
Successfully installed activerecord-3.1.0
Successfully installed activeresource-3.1.0
Successfully installed activesupport-3.1.0