Skip to content

Instantly share code, notes, and snippets.

View welingtonsampaio's full-sized avatar
🏠
Working from home

Welington Sampaio welingtonsampaio

🏠
Working from home
View GitHub Profile
@welingtonsampaio
welingtonsampaio / deploy.rb
Created April 8, 2013 23:37
Gist de configuração do capistrano em aplicação rails com ec2, pedido pelo grupo rails-br
##
# Fazendo deploy com o capistrano de uma aplicação Rails
# usando servidores da Amazon ec2 e unicorn como servidor
# o versionamento do ruby no ambiente de produção foi feito
# com o rbenv ( https://github.com/sstephenson/rbenv ), o SO
# esta com o Centos 5.3 x64
#
# Primeiramente é necessario instalar a gem com o comando:
# gem install capistrano
# ou adicione a linha: gem "capistrano", :group => :development
@welingtonsampaio
welingtonsampaio / README.md
Last active December 16, 2015 12:38
Melhores práticas para criar uma Aplicação Rails (zaez)

Melhores práticas para criar uma Aplicação Rails na ZAEZ

Definindo quais os padroes para se criar uma aplicação Rails na ZAEZ, ja configurando o ambiente para receber o testes de BDD utilizados na empresa.

Criando a aplicação no terminal

rails new app-name --skip-test-unit

@welingtonsampaio
welingtonsampaio / gist:5533777
Created May 7, 2013 16:02
Method for create url with subdomain
def with_subdomain(subdomain)
subdomain = (subdomain || "").to_s
subdomain += "." unless subdomain.empty?
domain=request.domain.gsub! /^(\w){2}\./, ""
[subdomain, domain].join
end
def url_for(options = nil)
if options.kind_of?(Hash) && options.has_key?(:subdomain)
options[:host] = with_subdomain(options.delete(:subdomain))
@welingtonsampaio
welingtonsampaio / jquery.hasSelector.js
Created August 22, 2013 12:56
Checks whether a selector in the document content
;;
(function($){
"use_strict"; // +_+ jshint
// Clone atual function
$.hasSelectorOld = $.hasSelector;
// the method
// @return Boolean
@welingtonsampaio
welingtonsampaio / database.yml
Created November 8, 2013 14:02
Model for Database.yml to rails
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
#! /bin/sh
### BEGIN INIT INFO
# Provides: puma
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@welingtonsampaio
welingtonsampaio / CreateComments.rb
Created August 31, 2015 17:00
RABL filter, like Facebook Graph API
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :title
t.text :content
t.bollean :active, default: false
t.belongs_to :user
t.timestamps null: false
end
add_index :comments, :user_id
@welingtonsampaio
welingtonsampaio / kill.sh
Last active November 8, 2018 20:31
Kill mining files
programs="crypto-pool nanopool supportxmr minexmr dwarfpool xmrpool moneropool xmr monero udevs udevd docker hashvault moneroocean evolutions littletrump jboss nanoWatch"
for i in ${programs}; do
unset $pid
pid=`ps -ef | grep $i | grep -v grep | awk '{print $1}'`
if [ ! -z $pid ]; then
kill -9 $pid
if [ -x skill ]; then
skill -KILL $i
@welingtonsampaio
welingtonsampaio / js.js
Last active October 5, 2020 14:13
urlSearchTransfer
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";(function(e){function n(t){var e,n,i,o,s,a,c=Object.create(null);if(this[u]=c,t)if(
@welingtonsampaio
welingtonsampaio / utm-transfer-v2.js
Last active August 25, 2020 18:35
utm-transfer-v2.js
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";(function(e){function n(t){var e,n,i,o,s,a,c=Object.create(null);if(this[u]=c,t)if(