Skip to content

Instantly share code, notes, and snippets.

View tinogomes's full-sized avatar
😀

Celestino Gomes tinogomes

😀
View GitHub Profile
// https://www.mql5.com/pt/articles/751
#define ERROR -1;
//+------------------------------------------------------------------+
//| Checking if a given filling mode is allowed |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed(string symbol, int fill_type)
{
@tinogomes
tinogomes / DNS_TO_LOCALHOST.markdown
Last active April 15, 2024 07:22
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@dux
dux / decorator_clone.rb
Last active October 20, 2023 13:51
Simple ruby decorators with example
class DecoratorClone
def initialize(model)
@model = model
end
def method_missing(m, *args)
raise NameError, "Decorator method '#{m}' not found" unless @model.respond_to?(m)
@model.send(m, *args)
end
end
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 28, 2024 23:01
Essential JavaScript Links
@rogerleite
rogerleite / converters.rb
Last active September 17, 2018 22:39
Ruby and CSV examples
require "csv"
require "date"
puts CSV::HeaderConverters.keys.inspect # => [:downcase, :symbol]
# Add new header converter
CSV::HeaderConverters[:remap] = lambda do |raw_value|
raw_value = raw_value.to_sym
case raw_value
when :country
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: