Skip to content

Instantly share code, notes, and snippets.

View brenoperucchi's full-sized avatar

Breno Perucchi brenoperucchi

View GitHub Profile
@brenoperucchi
brenoperucchi / i_bb_ema.mq5
Created May 25, 2023 18:13
Bollinger Band Indicator EMA
//+------------------------------------------------------------------+
//| BB.mq5 |
//| Copyright 2009, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property description "Bollinger Bands"
#include <MovingAverages.mqh>
//---
//+------------------------------------------------------------------+
//| BB-EMA.mq5 |
//| Copyright 2023, Imentore Copy |
//| Breno Cardoso Perucchi |
//+------------------------------------------------------------------+
#property copyright "Copyright Breno Perucchi"
#property description "BB EMA"
#property link "https://www.imentore.com"
#property version "1.32"
#property strict
input
iGain(3.0);
iStop(550);
iPeriod(20);
iDesvio(2.00);
var
vUpBB : Float;
vDownBB : Float;
vUpBBLast : Float;
vDownBBLast : Float;
@brenoperucchi
brenoperucchi / Rails, Puma & Nginx.md
Created February 14, 2023 03:36 — forked from davidteren/Rails, Puma & Nginx.md
Example setup for Puma with Nginx in a Rails app

In the apps config/puma.rb file:

Change to match your CPU core count
# Check using this on the server => grep -c processor /proc/cpuinfo
workers 4

# Min and Max threads per worker
threads 1, 6

app_dir = File.expand_path('../..', FILE)

@brenoperucchi
brenoperucchi / sublime-keymap
Last active January 3, 2016 16:04
Sublime Default Keymap
[
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+ctrl+m"], "command": "list_rails_models" },
{ "keys": ["super+ctrl+c"], "command": "list_rails_controllers" },
{ "keys": ["super+ctrl+v"], "command": "list_rails_views" },
{ "keys": ["super+ctrl+h"], "command": "list_rails_helpers" },
{ "keys": ["super+ctrl+x"], "command": "list_rails_fixtures" },
{ "keys": ["super+ctrl+t"], "command": "list_rails_tests" },
{ "keys": ["super+ctrl+i"], "command": "list_rails_javascripts" },
@brenoperucchi
brenoperucchi / form_tag.rb
Created December 27, 2015 16:33
Form Block Liquid Filter
require 'i18n'
class FormTag < Liquid::Block
Syntax = /(#{Liquid::QuotedFragment})\s*(by\s*(\d+))?/
def initialize(tag_name, markup, tokens)
@param_name = Liquid::Expression.parse(markup).name.gsub("form_", "")
super
end
def form_nested(params, index, object, html_name)
@brenoperucchi
brenoperucchi / paginate_tag.rb
Last active August 29, 2015 14:23
Paginate Tag with Liquid Filter using paginate gem
# Paginate a collection
#
# Usage:
#
# {% paginate contents.projects by 5 %}
# {% for project in paginate.collection %}
# {{ project.name }}
# {% endfor %}
# {% endpaginate %}
# First the end result of what we want:
class Foo
before_hook :whoa
before_hook :amazing
def test
puts "This is kinda cool!"
end
class CostCenterPresenter
def initialize(object, query)
@object = object
@query = query
end
# results: [
#1# { text: "Western", children: [
#2# { id: "CA", text: "California" },
#2# { id: "AZ", text: "Arizona" }
# ] },
@brenoperucchi
brenoperucchi / gist:6159298
Created August 5, 2013 20:26
Bash Prompt with GIT and RBENV Gemset and RubyVersion
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
source ~/.git-prompt.sh
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{