Skip to content

Instantly share code, notes, and snippets.

View repejota's full-sized avatar

Raül Pérez repejota

View GitHub Profile
@repejota
repejota / cp.js
Created August 18, 2012 21:08
Node js module that copy a file asyncrhonously using streams and calls a _callback_ when it finishes.
var fs = require("fs"),
util = require('util');
// Copy a file asyncrhonously using streams and calls a _callback_ when it
// finishes.
exports.cp = (function() {
return function (src, dst, cback, o) {
// Options can have:
//
// * **force**: (*bool*) wich determines if files are being overriten.
@repejota
repejota / gist:e600a5d61c0cf33c8bb7
Created April 30, 2014 10:41
Show errors in PHP
<?php
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
ini_set("display_errors", 1);
@repejota
repejota / index.html
Last active August 29, 2015 14:09
A simple sumByKey filter for AngularJS
<body>
<div class="container" ng-controller="TestCrtl">
<h1>AngularJS array sum by field/key filter example</h1>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Posts</th>
<th>Comments</th>
</tr>
def authorize_key_for_root(config, *key_paths)
[*key_paths, nil].each do |key_path|
if key_path.nil?
fail "Public key not found at following paths: #{key_paths.join(', ')}"
end
full_key_path = File.expand_path(key_path)
if File.exists?(full_key_path)
config.vm.provision 'file',
@repejota
repejota / nodeschool_kids_translations.md
Last active November 27, 2015 18:57
NodeSchool Kids translations

Català

Barcelona NodeSchool és part de l'esforç global anomenat NodeSchool que ensenya voluntàriament Node.js a tothom! El codi font pels tallers és completament de codi obert i l'esforç es totalment dirigit per la comunitat. La millor part és, que és totalment gratuït!

NodeSchool per nens té un format especial on nosaltres programarem robots, Tessel2 i altres coses xules a part del programa habitual "Learn You Node" (Aprèn Node).


English

#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
Verifying that +repejota is my blockchain ID. https://onename.com/repejota
function __promptline_git_changes {
local changes=0
if hash git 2>/dev/null; then
changes=$( { git status -s --porcelain; } 2>/dev/null | wc -l)
if [ $changes -gt -0 ]; then
printf "%d " ${changes}
fi
fi
return 1
}
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do