Skip to content

Instantly share code, notes, and snippets.

View bpedro's full-sized avatar
⌨️
Writing

Bruno Pedro bpedro

⌨️
Writing
View GitHub Profile
@bpedro
bpedro / postman2apiblueprint
Created March 10, 2015 19:49
Generates API Blueprint documentation from a POSTMAN Collection JSON file.
#!/usr/bin/env node
var fs = require('fs')
, url = require('url');
if (process.argv.length < 3) {
console.log('Usage:\n', process.argv[1] + ' <postman collection JSON file>\n\n');
process.exit();
}
@bpedro
bpedro / apiDocsCompare.js
Last active January 3, 2016 22:49
Crawl the Public API Directory, grab API documentation URLs and compare each documentation page with a previous saved version. This script uses import·io. Please see http://support.import.io/knowledgebase/articles/258104-integrate-import-io-with-node-js
var importio = require('import-io').client,
fs = require('fs'),
sha1 = require('sha1'),
http = require('http-get');
// importio configuration
var userGuid = 'YOUR_USER_GUID';
var apiKey = 'YOUR_API_KEY';
var io = new importio(userGuid,
apiKey,
@bpedro
bpedro / git_log_user.sh
Last active December 14, 2015 21:38
Find *yesterday*'s git entries from <username>. Useful for generating sprint daily meetings notes.
#!/bin/sh
if [ "$#" -eq 0 ]; then
echo ""
echo "Find yesterday's git entries from <username>"
echo ""
echo "Usage:"
echo "git_log_user.sh <username>"
echo ""
else
@bpedro
bpedro / svn_log_user.sh
Created August 30, 2011 15:28
Find today's SVN entries from <username>
#!/bin/sh
if [ "$#" -eq 0 ]; then
echo ""
echo "Find today's SVN entries from <username>"
echo ""
echo "Usage:"
echo "svn_log_user.sh <username>"
echo ""
else
@bpedro
bpedro / mkdir_p.js
Last active October 31, 2020 00:35
nodejs implementation of recursive directory creation (https://brunopedro.com/2010/12/15/recursive-directory-nodejs/)
var fs = require('fs');
/**
* Offers functionality similar to mkdir -p
*
* Asynchronous operation. No arguments other than a possible exception
* are given to the completion callback.
*/
function mkdir_p(path, mode, callback, position) {
mode = mode || 0777;
function obtainXmlHttp()
{
var xmlhttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
#! /bin/sh
if test "$2" = ""; then
echo "usage: $0 basedir depth"
exit 1
fi
if test "$2" = "0"; then
exit 0
fi