Skip to content

Instantly share code, notes, and snippets.

Eduardo Lavaque greduan

View GitHub Profile
View README.md

DocPad: Clean dates in post URLs

Creates URLs like /2012/12/15/merry-xmas.html for your blog posts.

Requires momentjs to be installed: npm install --save moment

@greduan
greduan / Gruntfile.js
Last active Dec 20, 2015 — forked from balupton/README.md
Using Grunt with DocPad
View Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Import package.json file, we get some info from here
pkg: grunt.file.readJSON('package.json'),
// Minify JS into one file
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
@greduan
greduan / CHANGELOG.md
Last active Dec 28, 2015
A template for GitHub projects' README file.
View CHANGELOG.md

Changelog

All notable changes to this project will be documented in this file.

0.0.0 - YYYY-MM-DD

Initial commit, nothing notable here.

View gist:7435313
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 24 2013 18:58:47)
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
@greduan
greduan / server.js
Last active Dec 29, 2015
Node.js static file web server, exports .start()
View server.js
var connect = require("connect"),
http = require("http");
var start = connect().use(connect.static(__dirname))
http.createServer(start).listen(2882);
console.log("Static file server running at\n => http://localhost:2882/\nCTRL + C to shutdown");
module.exports = start;
@greduan
greduan / nw-bundle.sh
Last active Dec 30, 2015
Bundle and open (in OS X) a node-webkit app
View nw-bundle.sh
#!/bin/sh
zip app.nw ./*
#xdg-open app.nw
#open app.nw
View core.clj
(ns kata-1.core)
(defn- str->nums [s]
(map read-string (re-seq #"[\d]+|[-\d]+" s)))
(defn add [s]
(let [nums (str->nums s)]
(when-let [neg-nums (not-empty (filter neg? nums))]
(throw (Exception. (str "Negatives not allowed:" neg-nums))))
(reduce + (filter #(<= % 1000) nums))))
@greduan
greduan / ruler.txt
Created May 19, 2014
Text ruler that goes up to 80 characters.
View ruler.txt
================================================================================
12345678901234567890123456789012345678901234567890123456789012345678901234567890
| | | | | | | | |
1 10 20 30 40 50 60 70 80
================================================================================
@greduan
greduan / minHash.js
Created Jun 1, 2014
Finds the shortest unique string for a string in an array of strings. Meant to be used with hashes
View minHash.js
/**
* Big thanks to Bruce who figured this out for me. What this function does is
* give you the shortest unique prefix of the strings (hashes) that you give it
* in the array.
*
* Args: {array} hashesArr, {function} callback
* Returns: {array} minHashes, through callback. Something like this:
*
* [ '1c',
* '28d',
View randomArray.js
// returns an array with a random chance of it's contents being more arrays or
// random strings
function randomArray(length) {
if (length == null)
length = 10;
var times = randTo.from1to(length); // amount of initial dirs/files
var result = [];
// make an array of times length
for (var i = 0; i <= times; i++) {
// random chance, hey it's a dir
You can’t perform that action at this time.