Skip to content

Instantly share code, notes, and snippets.

View erkobridee's full-sized avatar

Erko Bridee erkobridee

View GitHub Profile
@erkobridee
erkobridee / rest_url_design.md
Last active October 11, 2015 13:48
Proposta de URLs para aplicações que implementam REST

REST URL design

:app-name - nome da aplicação

:version - versionamento (é recomendado o uso, porém, não é obrigatório o uso)

:resource - nome do recurso exposto (entidade), sendo este nome no plural

GET, UPDATE, DELETE

@mariojunior
mariojunior / NTFS on MacOS 10.7 or later.
Last active December 14, 2015 17:29
Hd Externo usando NTFS com Mac OS 10.8 (Mountain Lion) (read/write)
Passo 1:
Baixe o NTFS-3G e instale-o
(http://sourceforge.net/projects/catacombae/files/NTFS-3G%20for%20Mac%20OS%20X/2010.10.2/ntfs-3g-2010.10.2-macosx.dmg/download)
Ao instala-lo, o MacFUSE será instalado junto (verifique se no Preference System tem dois novos items: MacFUSE e NTFS-3G).
Passo 2:
Baixe o fuse_wai-1.1pkg e instale-o
https://github.com/bfleischer/fuse_wait/downloads
@mariojunior
mariojunior / creating-iso-files-on-terminal
Last active December 15, 2015 15:29
How to create .iso files using Terminal on MacOS
First: Discovery where your Volume disk running:
-- sudo df -k /Volumes/*
Second: umount your Volume disk without remove the disk:
-- sudo umount /dev/disk3 ('dev/disk3' may be different, you must replace it according previous command)
Third: Create an ISO file mirroring the disc on specified path:
--- dd if=/dev/disk3/ of=PATH_TO_ISO_FILE.iso bs=2048 (remember about the 'dev/disk3' argument)
Wait some several minutes. You can open the Finder on your destiny ISO file to monitoring the growing of file, but sometimes the file size take some minutes to show the real size. Keep calm, take a coffee and relax. :)
@mariojunior
mariojunior / gist:6175736
Created August 7, 2013 16:36
AngularJS Learned Lessons #1: - Getting a Invalid Session State on response and trait it.
//Intercepting a Invalid Session status using an Interceptor:
//Following the sample described in http://docs.angularjs.org/api/ng.$http (see "Response inteceptors" paragraph)
//At error function handler:
function (response) {
//if the user's session is invalid, then the status code is zero.
if (response.status == 0) {
//Session Invalid! So, you can do anything... typically, you can dispatch a custom event to be handled by some controller
//and manipulate your models ou routing state.
$rootScope.$emit('redirect_event');
return;
@mariojunior
mariojunior / gist:6175849
Created August 7, 2013 16:47
AngularJS Learned Lessons #2: Enabling HTTP Credentials (needed by Session IDs)
//On config definition...
angular.module("moduleName").config(
function ($routeProvider, $httpProvider) {
//HERE THE IMPORTANT MAGIC LINE!
$httpProvider.defaults.withCredentials = true;
//If you don't set the line above, all $http will dispatch request without session_id to backend
//and the backend will not reconize the user session, giving your a big head pain! Believe on me.
//Question & Answer: http://stackoverflow.com/questions/17064791/http-doesnt-send-cookie-in-requests

Walkthrough of the following script (v8:6573).

var logFoo;
var promise1 = Promise.resolve().then( () => logFoo = () => console.log( "foo" ) );
promise1.then( () => logFoo() ).then( logFoo );

1. var logFoo;

@joaoneto
joaoneto / correios.js
Last active July 27, 2017 19:28
Track para os correios
var http = require('http');
var parseTrack = function (data) {
var trackLines = data.replace(/[\r\n]/g, '').replace(/<\/tr>/gi, '</tr>\n').match(/<tr.*?>(.*)<\/tr>/gi);
trackLines.shift();
var parsed = [], parts = [];
var length = trackLines.length;
var details, date, track;
while (length--) {
@mariojunior
mariojunior / gist:2924325
Created June 13, 2012 14:14
Showing / Hidding hidden Files on MacOSX
#To show your hidden files on Finder, use this script:
#To Show:
defaults write com.apple.finder AppleShowAllFiles -bool true
killall -TERM Finder
#To Hide them:
defaults write com.apple.finder AppleShowAllFiles -bool false
killall -TERM Finder
  1. Instale as dependências:
yarn add webpack babel-core babel-loader babel-preset-env
  1. Crie o arquivo de configuração do webpack:
touch webpack.config.js
@francisrstokes
francisrstokes / StateDispatcher.js
Last active May 28, 2019 02:31
Redux without redux - sharing state and one way data flow using only standard react
import React from 'react';
export class StateDispatcher extends React.Component {
constructor(props) {
super(props);
this.state = props.state || {};
this._dispatch = this.dispatch.bind(this);
}
dispatch(action) {