Skip to content

Instantly share code, notes, and snippets.

View evert0n's full-sized avatar

Everton Yoshitani evert0n

View GitHub Profile
@evert0n
evert0n / CONVENTIONS.md
Created August 16, 2018 12:57 — forked from alexweber/CONVENTIONS.md
Git Commit Conventions

Git Commit Conventions

Commit Conventions

<type>(scope): message

Types

  • feat (features)
  • fix (bug fixes)
@evert0n
evert0n / HOWTO.md
Created February 16, 2018 11:47 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@evert0n
evert0n / domainhacks.js
Created February 2, 2018 17:34 — forked from alexanderGugel/domainhacks.js
Domainhacks
var fs = require('fs');
var words = fs.readFileSync('/usr/share/dict/words', {
encoding: 'utf8'
}).split('\n');
var tlds = ['co', 'com', 'io', 'de', 'it'];
var results = [];
(function(y, o, d, a) {
var i = o.createElement(d);
i.scrolling = 'off'; i.frameborder = '0';
i.src = a; o.body.appendChild(i);
})(window, document, 'iframe', '//somedomain.tld');
@evert0n
evert0n / partial-update.js
Created January 5, 2018 14:06 — forked from 7ictor/partial-update.js
CouchDB update handler for partial updates of a document.
function (doc, req) {
var findTheChanges = function (prevK, obj) {
var arr = [];
for (var key in obj) {
var prevKey = prevK || '';
if (obj.hasOwnProperty(key)) {
var value = obj[key];
// If its an Object dig deeper.
if (value !== null &&
typeof value === 'object' &&
@evert0n
evert0n / ng-debounce.js
Created December 20, 2017 23:57 — forked from tommaitland/ng-debounce.js
Debounce/Throttling Directive for Angular JS 1.2+
angular.module('app', []).directive('ngDebounce', function($timeout) {
return {
restrict: 'A',
require: 'ngModel',
priority: 99,
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input');
@evert0n
evert0n / docker-swarm-ports.md
Created August 30, 2017 16:32 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication
  • UDP port 4789 for "data plane" VXLAN overlay network traffic

AWS Security Group Example

AWS Tip: You should use Security Groups in AWS's "source" field rather then subnets, so SG's will all dynamically update when new nodes are added.

@evert0n
evert0n / parseUri.js
Created August 29, 2017 13:39 — forked from prayashm/parseUri.js
Parse URI
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {