Skip to content

Instantly share code, notes, and snippets.

View wevtimoteo's full-sized avatar
🎲
Rolling dices

Weverton Timoteo wevtimoteo

🎲
Rolling dices
View GitHub Profile
@wevtimoteo
wevtimoteo / retry_github_app_deliveries.js
Last active August 8, 2023 17:01
Retry GitHub app - Deliveries
const GitHubDeliveryManager = {
retryReasons: [
"Couldn't connect to server",
"Service Timeout",
"An Exception Occurred",
"502 Bad Gateway",
"timed out"
],
sleep: function(lf_ms) {
@sawant
sawant / homebrew old version.txt
Last active March 16, 2024 05:35
Install older version of Formula in Homebrew
[From: http://hanxue-it.blogspot.com/2018/08/macos-homebrew-installing-older-version-of-software.html - just created a copy to keep it for long term]
Homebrew always wants to install the latest version of the Formula (software). This is by design, because every time there is an update to a formula, it wants to be tested against all the other formulas that it depends on. Mixing new and old versions of software is a recipe for incompatibility disaster.
But sometimes there are situations where you need an older version of software. In my specific case, Yarn was compiled against an older version of icu4c, and I want that older version instead of recompiling Yarn.
$ yarn install
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
Referenced from: /usr/local/bin/node
@zupzup
zupzup / main.go
Created July 14, 2017 12:46
Example for Basic AST Traversal in Go
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"log"
"os"
@guih
guih / floripa_on_rails_meetup_tdd.rb
Created March 15, 2017 13:03
FloripaOnRails Meetup - TDD
# =============
# What is TDD ?
# =============
# Writing test first is not TDD, you should let your test guide your code
# so the test bellow should have the simplest implementation as possible
it 'consumes fuel' do
expect { drive(80) }.to change(car, :fuel).from(10).to(2)
end
@emilsoman
emilsoman / phoenix_to_umbrella
Last active April 12, 2024 11:26
How to move an existing phoenix app under an umbrella app
How to convert existing phoenix app to an umbrella app.
https://elixir-lang.slack.com/archives/phoenix/p1472921051000134
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
[10:14]
1) mix new my_umbrella --umbrella
@chris-roerig
chris-roerig / ruby_macro_methds.rb
Last active July 14, 2020 20:59
How to add macro style methods to a rails model
# Rails Concern
# models/concerns/nicknameable.rb
module Nicknameable
extend ActiveSupport::Concern
included do
def self.nicknames(*args)
define_method("nicknames") { args }
end
nicknames
@nuxlli
nuxlli / Azkfile.js
Created November 3, 2015 20:37
"bins" example in Azkfile
aliases({
bundle : { command: ["bundle", "exec"]}, // system: azkdemo (default)
scaffold : { alias: "bundle", append: ["rails", "g", "scaffold"]},
test : { alias: "bundle", append: ["rake", "test"], tty: true, context: 'test'},
'import-db': { system: "mysql", command: ["mysql"], depends: false}
});
// azk script generator --path ./script
// ./script/bundle
// ./script/scaffold

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console. The option Brazil +55 will be the first on the list, already selected:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@joyrexus
joyrexus / README.md
Last active June 8, 2023 07:45
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

@geeksam
geeksam / dsl-or-api-checklist.md
Last active June 12, 2017 20:46
The "Is It a DSL or an API?" Ten Question Checklist

[NOTE: The original version was posted in 2007 on an O'Reilly blog, but the page has been erroring out for months now. I'm copying it here because archive.org, while useful, can be slow. chromatic is a lovely person who (he thinks) probably has copyright to this piece.]


The "Is It a DSL or an API?" Ten Question Checklist

Saturday May 19, 2007 6:00AM
by chromatic in Opinion