Skip to content

Instantly share code, notes, and snippets.

View darkside's full-sized avatar

Leonardo Bighetti darkside

View GitHub Profile
@darkside
darkside / registrations.log
Created June 17, 2020 19:00
POST /registrations
2020-06-17T18:58:45.222800+00:00 app[web.1]: I, [2020-06-17T18:58:45.222660 #34] INFO -- : [cd6c3cd7-9efc-4564-a66f-262ed5e155a3] {"method":"POST","path":"/auth/registrations","format":"html","controller":"Auth::RegistrationsController","action":"create","status":422,"duration":646.07,"view":1.39,"db":552.84,"request_id":"cd6c3cd7-9efc-4564-a66f-262ed5e155a3","params":{"data":{"type":"users","attributes":{"email":"[email protected]","authentications_attributes":[{"provider":"apple","oauth_token":"eyJraWQiOiI4NkQ4OEtmIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiZGlnaXRhbC5waWVyLnN0YWdpbmciLCJleHAiOjE1OTI0MjA5MjQsImlhdCI6MTU5MjQyMDMyNCwic3ViIjoiMDAxODcwLmJhZWFkOWI2Y2VlMTQyNTdhYjRmOWMzYmQxNjcwMWFkLjE3NTkiLCJub25jZSI6ImU4NDgwMjkzZjQ0OTFiNjE0MTUxZjg4MGU5Zjc3ZDE4Y2RhYmEzNDFhNjEzOGViMzg1OTE0OGUyNTVmZWEwNjMiLCJjX2hhc2giOiJrY1VvS0lXelJmaTVvTWxPdFhKMlJ3IiwiZW1haWwiOiJndWlsaGVybWUuemlvbGxlQHBpZXIuZGlnaXRhbCIsImVtYWlsX3ZlcmlmaWVkIjoidHJ1ZSIsImF1dGhfdGltZSI6MTU5MjQyMDMyNCwibm
@darkside
darkside / contain_within_matcher.rb
Created February 11, 2015 23:30
contain and within for capybara
# Must have Nokogiri gem installed and save this file in your spec/support dir
# Allows you to write cleaner/faster specs in your views (50% faster than css_select)
# Increased readability in your spec doc
# ex.
# rendered.should contain('my heading').within('h1') # searches all H1 tags for 'my heading'
# or
# rendered.should contain('my string') # searches entire rendered string for 'my string'
class Within
def initialize(expected, css_selector)
@expected = expected
@darkside
darkside / rails_helper.rb
Created January 21, 2015 20:44
Spec helper creating seeds
config.before :suite do
# Make sure we cleanup (if anything went wrong it could leave the DB
# in a dirty state)
DatabaseCleaner.clean_with :truncation
# Create a master company.
master_company = FactoryGirl::SeedGenerator.create :master_company
Role.available_roles.each do |r|
# Create roles and a default user for each role
FactoryGirl::SeedGenerator.create :"#{r}_role"
FactoryGirl::SeedGenerator.create r
@darkside
darkside / gist:9104922
Last active August 29, 2015 13:56
product_404
Product Modifier Class for 404 (Baby Spinach)
{
:active => true,
:amount_free => nil,
:amount_free_is_dollars => nil,
:auto_jumping => false,
:created_by => "/enterprise/User/1/",
:created_date => "2013-11-17T16:44:31.120325",
:forced => true,
@darkside
darkside / nginx_auth_basic
Created June 10, 2013 22:56
Protect sidekiq dashboard with nginx basic auth
location /sidekiq {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
if (!-f $request_filename) {
proxy_pass http://unicorn;
break;
}
}
@darkside
darkside / gist:1207663
Created September 10, 2011 00:07
God override sudo with rvmsudo
namespace :god do
namespace :restart do
task :default, :roles => :app, :except => { :no_release => true } do
run "rvmsudo #{bin_god} restart #{application}"
end
end
end
var fullScreen = false;
function getMyApp(appName)
{
if(navigator.appName.indexOf ("Microsoft") !=-1)
{
return window[appName];
}else{
return document[appName];
}
@darkside
darkside / GuestFormStep.rb
Created March 16, 2011 19:46
class GuestFormStep < ActiveRecord::Base
class GuestFormStep < ActiveRecord::Base
abstract_class = true
translates :name, :description
belongs_to :guest_form
has_many :questions, :dependent => :destroy, :order => 'position'
validates_presence_of :name
validates_presence_of :type
validates_presence_of :guest_form
@darkside
darkside / application.rb
Created January 17, 2011 16:27
Capistrano Recipes Application.rb
Capistrano::Configuration.instance(:must_exist).load do
# User settings
set :user, 'deploy' unless exists?(:user)
set :group,'www-data' unless exists?(:group)
# Server settings
set :app_server, :unicorn unless exists?(:app_server)
set :web_server, :nginx unless exists?(:web_server)
@darkside
darkside / resque_god_recipe.god
Created December 28, 2010 18:27
Resque God Recipe
# ------------------------------------------------------------------------------
# Resque
# Manages background jobs and does all the hard work so we dont have to.
#
# Notes:
# This configuration assumes we are only using one background worker for our
# tasks. This makes it easier to let god take care of it, since there's only
# one pid to control.
#
# There's also a hackish, ugly thread that runs with it to kill anyone stuck,