Skip to content

Instantly share code, notes, and snippets.

View jaime-ez's full-sized avatar

jaime echegaray zipper jaime-ez

  • Santiago, Chile
View GitHub Profile
@jaime-ez
jaime-ez / rut.js
Created May 6, 2015 18:08
Generate chilean RUT between min and max values
var dv, rut, min, max;
var M=0,S=1;
var T = Math.floor(Math.random() * (max - min + 1)) + min;
rut = T;
for(;T;T=Math.floor(T/10)) {
S=(S+T%10*(9-M++%6))%11;
}
dv= S?S-1:'K';
rut = rut + '-' + dv;
@jaime-ez
jaime-ez / forbidden_usernames.js
Created June 1, 2015 20:41
forbidden usernames
// alexa most visited domains: http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
var domains = require('./domains.json');
//consider the first x most visited urls
var limit = 50000;
//forbidden words: https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.json
var forbidden = require('./forbidden.json');
var output = {};
for (i=0; i < limit ; i++) {

Grunt and Cordova 3

The advantages of using Grunt with Cordova:

  1. It simplifies working with the cordova cli.
  2. It provides a mechanism to copy platform customization to the platforms directory without having to commit the generated plugins and platforms directories to version control.
  3. It provides a way to watch resources and automatically run cordova commands.

Stack Overflow: .gitignore for PhoneGap/Cordova 3.0 projects - what should I commit?

<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{colombiaIdType}} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-show="colombiaIdType !== 'NIT'"><a href="" ng-click="colombiaIdType = 'NIT'">NIT</a></li>
<li ng-show="colombiaIdType !== 'CE'"><a href="" ng-click="colombiaIdType = 'CE'">CE</a></li>
<li ng-show="colombiaIdType !== 'CC'"><a href="" ng-click="colombiaIdType = 'CC'">CC</a></li>
</ul>
</div>
<input type="text" class="form-control" ng-model="destinationOpts.bankAccountHolderId" placeholder="Número de identidad del destinatario" required validate-id-colombia>
@jaime-ez
jaime-ez / electronAndYeoman.md
Last active February 21, 2017 13:36
building electron apps based on yeoman generator-angular
  • for ngRouter to work links must be in the form <li><a ng-href="#!/about">About</a></li>
  • make a symlink from app/bower_components to ./bower_components (done as Grunt task)
  • use https://github.com/jaime-ez/elemon.git for livereload
  • trick to load modules in index.html (http://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined)
  • add electron as devDependencies, copy package.json and node_modules into dist folder (done as grunt task) and there call electron-packager
  • package.json must include every module called from main.js (whether used for dev purposes or not) and must include the field main pointing to the main entry file for electron (main.js)
@jaime-ez
jaime-ez / postgresqlSetup.md
Last active January 27, 2020 21:17
Setup postgresql on Linux

Setting up Postgresql on a new Debian8 instance

Install necessary packages

# run as root
root$ apt-get update && apt-get upgrade
root$ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list
root$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
root$ apt-get update -y
@jaime-ez
jaime-ez / setup.sh
Last active March 1, 2017 11:43
Set up a new Debian server on GCE with git and nvm (setting locale is needed)
#!/bin/bash
# usage: curl gist_raw_url > setup.sh && . setup.sh
#set locale as en_US.UTF-8
sudo export LC_ALL="en_US.UTF-8"
sudo locale-gen
#update
sudo apt-get update && sudo apt-get -y upgrade
@jaime-ez
jaime-ez / payments.md
Last active March 1, 2017 11:45
List of current crypto / payment channels projects
#!/bin/bash
#set locale as en_US.UTF-8
export LC_ALL="en_US.UTF-8"
locale-gen
#update
apt-get update && sudo apt-get -y upgrade
#git