Skip to content

Instantly share code, notes, and snippets.

View erkobridee's full-sized avatar

Erko Bridee erkobridee

View GitHub Profile
@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. :)
@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--) {
@Swop
Swop / push-to-new-repo.sh
Last active June 4, 2019 11:19
Push an entire local Git repository to a new remote repository
#!/bin/bash
# The command must be called inside the Git repository to send to the new repository
# Usage: push-to-new-repo.sh TARGET_REPO_URL
remote=origin;
target_repo=$1;
nb_branches=`git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/[^\/]+\//,"",$1); print $1}' | wc -l | sed 's/ //g'`;
echo "${nb_branches} branch(es) to push";
@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
@aras-p
aras-p / preprocessor_fun.h
Last active May 28, 2024 05:15
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@pauloricardomg
pauloricardomg / cors.nginxconf
Last active March 8, 2024 18:31
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@pbojinov
pbojinov / README.md
Last active December 8, 2023 21:09
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@fdaciuk
fdaciuk / Esconder_console_log.md
Last active September 3, 2021 15:00
Esconder console.log() quando o site for para produção

Esconder console.log() para o site em produção

  • Trocar o www.mywebsite.com pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().