Skip to content

Instantly share code, notes, and snippets.

View douglasresende's full-sized avatar
💡
I'll do my best

Douglas douglasresende

💡
I'll do my best
  • San Francisco, CA
View GitHub Profile
@douglasresende
douglasresende / quick_to_dev_backbone.js
Created October 17, 2016 01:20 — forked from jiahut/quick_to_dev_backbone.js
require jquery and backbone in cosole and coding...
(function(undefined){
var _requirejs = document.createElement('script');
_requirejs.src = "http://requirejs.org/docs/release/2.1.5/minified/require.js";
_requirejs.type ="text/javascript";
document.head.appendChild(_requirejs);
setTimeout(function(){
require('http://code.jquery.com/jquery-1.9.1.min.js'.split(";"));
require('http://underscorejs.org/underscore-min.js'.split(";"),function(){
require('http://backbonejs.org/backbone-min.js'.split(";"))
});
@douglasresende
douglasresende / wait_until.rb
Created February 7, 2017 16:05 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
@douglasresende
douglasresende / docker-compose.yml
Created August 11, 2017 00:50 — forked from tebeka/docker-compose.yml
HAProxy in front of Elasticsearch
elastic:
image: elasticsearch
haproxy:
image: haproxy
volumes:
- ${PWD}:/usr/local/etc/haproxy
links:
- elastic
ports:
@douglasresende
douglasresende / deploy.rb
Created October 26, 2017 19:07 — forked from andruby/deploy.rb
Start and Stop tasks for resque workers, with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
@douglasresende
douglasresende / faster-unit-testing-in-rails-without-rails.rb
Created November 20, 2017 10:17 — forked from peter/faster-unit-testing-in-rails-without-rails.rb
Faster Unit Testing in Rails Without Loading Rails
# Running a single minimalistic unit test with Rails 4 and Ruby 2.1.1 is a lot faster
# if you avoid loading Rails:
# Running the test *with* Rails
time ruby -Itest test/models/my_model_test.rb # => real ~ 6s
# Running the test *without* Rails
time ruby -Itest/no_rails test/models/my_model_test.rb # => real ~ 0.6s

DigitalOcean S5

  • 5$
  • 1 CPU
  • 512Mb memory
  • 1T transfer
  • 20GB SSD

CPU info

@douglasresende
douglasresende / IMfromsource.md
Created April 20, 2018 17:29 — forked from makenova/IMfromsource.md
Install ImageMagick from source on Ubuntu 14.04

Install ImageMagick from source on Ubuntu 14.04

The version of ImageMagick that is installed when you run apt-get install imagemagick on Ubuntu 14.04 is older than I would like.

$ convert --version
Version: ImageMagick 6.7.7-10 2016-06-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
@douglasresende
douglasresende / readme.md
Created August 16, 2018 19:47 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
@douglasresende
douglasresende / webpacker_rails.md
Created August 16, 2018 19:50 — forked from maxivak/webpacker_rails.md
Webpack, Yarn, Npm in Rails
@douglasresende
douglasresende / fp_01.rb
Created January 17, 2019 14:51 — forked from serradura/fp_01.rb
Examples of how Ruby 2.6 is more functional than ever! 👏🎉🚀
raise 'Wrong Ruby version!' unless RUBY_VERSION >= '2.6.0'
module Strings
Trim = -> str { String(str).strip }
Replace = -> (sub, new_sub, str) { String(str).gsub(sub, new_sub) }
LowerCase = -> str { String(str).downcase }
end
# -- Alternative syntax --
Slugify = # Slugify =