Skip to content

Instantly share code, notes, and snippets.

View otaviomedeiros's full-sized avatar

Otavio Medeiros otaviomedeiros

  • VNDA e-commerce
  • Florianópolis
View GitHub Profile
@otaviomedeiros
otaviomedeiros / .env
Last active November 19, 2021 21:41
Ruby on Rails with Sidekiq and docker compose
PORT=3000
REDIS_PORT=6379
SIDEKIQ_REDIS_URL=redis://redis:6379/0
APP_DATABASE_HOST=database
APP_DATABASE_PORT=5432
APP_DATABASE_NAME=app_development
APP_DATABASE_USERNAME=postgres
APP_DATABASE_PASSWORD=postgres
@otaviomedeiros
otaviomedeiros / validate_with_matcher.rb
Created March 14, 2012 00:05
RSpec matcher for validates_with
# RSpec matcher for validates_with.
# https://gist.github.com/2032846
# Usage:
#
# describe User do
# it { should validate_with CustomValidator }
# end
RSpec::Matchers.define :validate_with do |validator|
match do |subject|
@otaviomedeiros
otaviomedeiros / alias_matcher.rb
Created March 1, 2012 16:18
RSpec matcher for alias_method
# RSpec matcher for alias_method.
# https://gist.github.com/1950961
# Usage:
#
# describe User do
# it { should alias_from(:username).to(:email) }
# end
RSpec::Matchers.define :alias_from do |alias_method|
@otaviomedeiros
otaviomedeiros / webpack.config.js
Created May 5, 2017 18:45
Webpack build with code splitting
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var baseCSS = new ExtractTextPlugin({ filename: "base.css" });
var vendorCSS = new ExtractTextPlugin({ filename: "[name].css", allChunks: true });
var VENDOR = [
"angular",
"angular-aria",
# x server
Xvfb :1 -screen 0 1024x768x24 &
# seta display para o firefox achar o xvfb
export DISPLAY=:1 # export to /etc/profile
# mostra o processo
jobs
# mata o processo
@otaviomedeiros
otaviomedeiros / gist:e015b25d10c367fd63d1
Created March 21, 2016 13:02
Elastic search indexing - Products
# ------- PRODUCTS
# mappings
PUT connectere
{
"settings": {
"analysis": {
"analyzer": {
"ngram_analyzer": {
"tokenizer": "ngram_tokenizer",
"filter": [
@otaviomedeiros
otaviomedeiros / gist:4f604a39c9f5bf0e50f6
Last active August 29, 2015 14:01
Workaround for devise sign in when using flash responder
# initializer to use when config.responders.flash_keys = [ :success, :error ]
module Responders
module FlashResponder
alias_method :original_set_flash_message?, :set_flash_message?
private
def set_flash_message?
sudo apt-get install x11vnc
x11vnc -display :1
@otaviomedeiros
otaviomedeiros / gist:11228764
Created April 23, 2014 19:16
firefox utils
# ff plugins
ls /usr/lib/mozilla/plugins/
# pode ser aqui tambem
ls /usr/lib/firefox-addons/plugins
# ff config
cat ~/.mozilla/firefox/<something>.default/prefs.js
# estar uma config para o ff
@otaviomedeiros
otaviomedeiros / gist:11228831
Created April 23, 2014 19:18
selenium firefox profile
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "#{Rails.root.to_s}/tmp"
profile['browser.download.folderList'] = 2
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/ofx,application/ofx,application/x-ofx"
profile['pdfjs.disabled'] = true
profile['plugin.state.java'] = 2 # plugin java always active