Skip to content

Instantly share code, notes, and snippets.

@adhusson
adhusson / test
Last active December 3, 2018 12:55
test7
@adhusson
adhusson / .vimrc
Created May 6, 2011 11:07 — forked from jeresig/.vimrc
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
{
"name": "India", // Album name
"latlon": { // Can be null. Geographic coordinates of album.
"lat": "19.3111433550646",
"lon": "78.92578125",
},
"request_params": { // Request parameters
"album": "India"
},
"related": [ // Can be null. Max. size 8. Array of related albums
@adhusson
adhusson / gist:714697
Created November 25, 2010 00:30
Convert ruby hashes from 1.8 to 1.9 style. Using perl regexp (I invoke it from vim)
s/:([^ ]*?)( +)=>( +)(.*?)($|,| )/$1:$2$4$5/g
$ thin start
>> Using rack adapter
/home/hp/wa/config.ru:6:in `require': no such file to load -- application.rb (LoadError)
from /home/hp/wa/config.ru:6:in `block in <main>'
from /home/hp/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /home/hp/.rvm/gems/ruby-1.9.2-head/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from /home/hp/wa/config.ru:1:in `new'
from /home/hp/wa/config.ru:1:in `<main>'
from /home/hp/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `eval'
from /home/hp/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `load'
Question.all
NameError: undefined local variable or method `scoped' for #<Class:0x7f329af4>
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta3/lib/active_record/base.rb:1141:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta3/lib/active_record/base.rb:403:in `all'
from (irb):9
Timeout::Error - execution expired:
/usr/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
/usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/lib/ruby/1.8/net/smtp.rb:911:in `recv_response'
/usr/lib/ruby/1.8/net/smtp.rb:554:in `do_start'
/usr/lib/ruby/1.8/net/smtp.rb:921:in `critical'
/usr/lib/ruby/1.8/net/smtp.rb:554:in `do_start'
/usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
t::SMTPAuthenticationError - 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. z33sm8723552wbd.1
:
/usr/lib/ruby/1.8/net/smtp.rb:942:in `check_auth_response'
/usr/lib/ruby/1.8/net/smtp.rb:733:in `auth_plain'
/usr/lib/ruby/1.8/net/smtp.rb:725:in `send'
/usr/lib/ruby/1.8/net/smtp.rb:725:in `authenticate'
/usr/lib/ruby/1.8/net/smtp.rb:566:in `do_start'
/usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
/usr/lib/ruby/gems/1.8/gems/mail-2.2.1/lib/mail/network/delivery_methods/smtp.rb:101:in `deliver!'
/usr/lib/ruby/gems/1.8/gems/mail-2.2.1/lib/mail/message.rb:238:in `deliver!'
require 'rubygems'
require 'exceptional'
require 'sinatra'
Exceptional.api_key = "...your api key..."
module Exceptional
def self.handle_sinatra(exception, uri, request, params)
e = Exceptional.parse(exception)
require 'sinatra/base'
require 'pony'
require 'erubis'
require 'validatable'
Dir["lib/*.rb"].each {|file| require file }
class FermeGallard < Sinatra::Base
set :sessions, true
configure do