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 / 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
@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 / 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 / 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 / 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 / Native_FullScreen.js
Created October 17, 2016 01:20 — forked from jiahut/Native_FullScreen.js
Native FullScreen JavaScript API
/*
Native FullScreen JavaScript API
CopyRight: Johndyer, http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/
-------------
Assumes Mozilla naming conventions instead of W3C for now
*/
(function() {
var
fullScreenApi = {
supportsFullScreen: false,
@douglasresende
douglasresende / neopixel_ota.ino
Created September 6, 2016 02:55 — forked from probonopd/neopixel_ota.ino
Trying to combine ArduinoOTA with Adafruit_NeoPixel
//#######################################################
//# Trying to combine ArduinoOTA with JoDaNl/esp8266_ws2812_i2s # [ERROR]: No Answer
//#######################################################
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
@douglasresende
douglasresende / melvanimate.md
Created September 6, 2016 02:54 — forked from probonopd/melvanimate.md
Getting Melvanimate to fly :-)

Getting Melvanimate to fly :-)

What is Melvanimate?

Melvanimate is a library for ESP8266 that lets you control your Neopixels over WLAN easily. It supports everything imaginable besides toasting your toast, e.g.,:

  • Animate Neopixels (hence the name!) or set them to solid colors
  • Control LEDs via a web interface (for casually setting a certain color of effect)
  • Control LEDs via MQTT or DMX/E131 (for automation)
  • Adalight DIY ambient monitor lighting similar to Ambilight
@douglasresende
douglasresende / platformio.txt
Created September 6, 2016 02:52 — forked from probonopd/platformio.txt
Using PlatformIO
sudo apt-get -y install python-pip git
sudo pip install -U platformio
platformio -f init --ide clion --board esp12e
sudo chmod 777 /dev/tty*
platformio serialports list
cp ~/.platformio/packages/framework-arduinoespressif/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino src/
# Set upload speed from 115200 to 921600
echo "upload_speed=921600" >> platformio.ini
@douglasresende
douglasresende / digital_ocean_setup.md
Created March 9, 2016 21:49 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password