Skip to content

Instantly share code, notes, and snippets.

View gist:8223488
Server Error in '/' Application.
Sequence contains no elements
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains no elements
Source Error:
View example.rb
class Model
default_scope where(deleted_at: nil)
def destroy_without_callbacks
self.deleted_at = Time.now.utc
update_without_callbacks
end
def destroy
run_callbacks :destroy do
View delayed_job_airbrake.rb
require 'airbrake'
module Delayed
class Worker
def handle_failed_job_with_aibrake(job, error)
Airbrake.notify_or_ignore(error, :cgi_data => job.attributes)
handle_failed_job_without_aibrake(job, error)
end
alias_method_chain :handle_failed_job, :aibrake
end
View .gvimrc
set go-=T
set bg=dark
if &background == "dark"
hi normal guibg=black
set transp=8
endif
set wildmenu
set lines=120
set columns=130
View campaign_mailer.rb
class CampaignMailer < ActionMailer::Base
def omg_notification(zomg)
mail :to => # ...
end
end
View gist:1170760
login = 'mail...'
password = 'pass...'
require "net/http"
require "net/https"
uri = URI.parse("https://eventioz.com/session.json")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
View widget.js
(function(a,b){function O(a){for(var b=0;b<J.bundles.length;b++)for(var c in J.bundles[b])if(c!=a&&v(J.bundles[b][c],a)>-1)return c}function N(){a.using=m,a.provide=n,a.define=o,a.loadrunner=p;return M}function L(a){var b,c;for(var d=0,e;e=J.matchers[d];d++){var f=e[0],g=e[1];if(b=a.match(f))return g(a)}throw new Error(a+" was not recognised by loader")}function K(a,b){var c=[];for(var d=0,e;e=a[d];d++)typeof e=="string"&&(e=L(e)),u(e)&&(e=new C(K(e,b),b)),c.push(e);return c}function J(){var a=t(arguments),b,c;typeof a[a.length-1]=="function"&&(b=a.pop()),typeof a[a.length-1]=="boolean"&&(c=a.pop());var d=new B(K(a,c),c);b&&d.then(b);return d}function I(){var a=t(arguments),b=[],c,d;typeof a[0]=="string"&&(c=a.shift()),u(a[0])&&(b=a.shift()),d=a.shift();return E(c,function(a){function f(){var e=H(t(b),c),f;typeof d=="function"?f=d.apply(c,e):f=d,typeof f=="undefined"&&(f=c.exports),a(f)}var c=this,e=[];for(var g=0,h=b.length;g<h;g++){var i=b[g];v(["require","exports"],i)==-1&&e.push(G(i,c))}e.length>0?J.apply
View gist:963301
def test_does_not_delete_association_if_it_was_removed
author_address = AuthorAddress.first
author = author_address.author
author.author_address_id = nil
assert author.save
author.destroy
assert AuthorAddress.find(author_address.id)
View gist:734726
" Add me to gvimrc :-)
map <D-1> :tabn 1<CR>
map <D-2> :tabn 2<CR>
map <D-3> :tabn 3<CR>
map <D-4> :tabn 4<CR>
map <D-5> :tabn 5<CR>
map <D-6> :tabn 6<CR>
map <D-7> :tabn 7<CR>
map <D-8> :tabn 8<CR>
View gist:715746
$:.unshift(File.expand_path("~/.rvm/lib"))
require 'rvm/capistrano'
require 'bundler/capistrano'
set :rvm_ruby_string, '1.9.2-p0'
if ENV['STAGE'] == 'staging'
set :rvm_type, :user
set :branch, "jammit"
set :application, "app_name_staging"