Skip to content

Instantly share code, notes, and snippets.

View erkobridee's full-sized avatar

Erko Bridee erkobridee

View GitHub Profile
@erkobridee
erkobridee / array_reduce_balanced_parens.js
Last active April 14, 2017 02:47
check balanced parens using Array.reduce function
function balancedParens(string){
return !string.split('').reduce(function(previous, char){
if(previous < 0) { return previous; }
if(char === '(') { return ++previous; }
if(char === ')'){ return --previous; }
return previous;
}, 0);
}
@erkobridee
erkobridee / gh-pages_directories.md
Last active November 7, 2016 22:44
about GH pages directories

info from Github staff:

To make it easier to vendor third-party dependencies via package managers like Bundler or NPM (or Yarn), Jekyll now ignores the vendor and node_modules directories by default, speeding up build times and avoiding potential errors. If you need those directories included in your site, simply add them to your configuration's include directive.

just keep in mind, avoid directories with names: vendors or node_modules when deploy anything to gh-pages =)


other info from Github staff:

Since you're not using Jekyll, it will be easier for you to add an empty .nojekyll file to the root of your repository. This will tell Jekyll not to run, and then your vendored files will be included in the build.

function safeScopeApply(){
// safe scope call
if(
$scope.$root.$$phase !== '$apply' &&
$scope.$root.$$phase !== '$digest'
) {
$scope.$apply();
}
}
@erkobridee
erkobridee / os-segredos-da-mente-milionaria.md
Last active March 10, 2025 10:32 — forked from gustavohenrique/os-segredos-da-mente-milionaria.txt
Resumo do livro Os Segredos da Mente Milionária

Os segredos da mente milionária (João Augusto Rodrigues)

Ou você controla o seu dinheiro ou ele controlará você. - O hábito de administrar as finanças é mais importante do que a quantidade de dinheiro que você tem. - A sua motivação para enriquecer é crucial: se ela possui uma raiz negativa, como o medo, a raiva ou a necessidade de provar algo a si mesmo, o dinheiro nunca lhe trará felicidade. - O segredo do sucesso não é tentar evitar os problemas nem se livrar deles, mas crescer pessoalmente para se tornar maior do que qualquer adversidade. - Os gastos excessivos têm pouco a ver com o que você está comprando e tudo a ver com a falta de satisfação na sua vida.

A resposta, segundo o autor, está no modelo pessoal de dinheiro que todos nós trazemos gravado no subconsciente.

Acima de tudo, sentia medo. Temia fracassar, ou pior, ter sucesso e acabar perdendo tudo. Nesse caso, eu seria realmente um panaca. Pior, destruiria a única coisa que soprava a meu favor: a lenda de que eu tinha um grande potencial. E s

@erkobridee
erkobridee / formPreventSubmit.html
Last active November 23, 2015 16:51
prevent form submit on enter key press
<!-- useful when working with angular -->
<form
name="nameForm" novalidate
onkeydown="return !((event.keyCode===13) && (event.target.type==='text'))">
<!-- prevent form submit on enter -->
<input type="text" name="name">
<textarea name="description"></textarea>
@erkobridee
erkobridee / moment_parseDate.js
Last active November 10, 2016 15:15
parse raw date and get correct moment.js object
// http://momentjs.com/
/**
* Creates and returns a moment object form the 'rawDate' or null in case of an invalid date
* @param rawDate
* @return {moment}
*/
function parseDate(rawDate){
if(!rawDate){
return moment.invalid();
(function(){
'use strict';
function PubSubService(){
/**
* based on: http://davidwalsh.name/pubsub-javascript
*/
var topics = {};
//----------------------------------------------------------------------------