Skip to content

Instantly share code, notes, and snippets.

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@makevoid
makevoid / hosted_example.txt
Created August 27, 2011 02:01
JQuery DOM HighLighter (it's a basic "Inspect element" simple implementation to mimic what webkit inspector and firebug do)
http://uploads.makevoid.com/jquery_dom_highlighter.html
@codebox
codebox / Mosaic.java
Created September 21, 2011 19:46
Java code to create a mosaic image from multiple small tiles (the code is a bit rough, sorry)
package uk.org.codebox.mosaic;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@michaelcontento
michaelcontento / lxc-ubuntu.sh
Created January 3, 2012 20:45 — forked from dkulchenko/lxc-ubuntu
Script to generate LXC containers for EC2
#!/bin/bash
#
# Template script for generating ubuntu container for LXC with the same
# ubuntu relase as the host
#
# This script is based on lxc-debian for EC2 (Daniil Kulchenko <daniil@kulchenko.com>)
# wich itself is based on lxc-debian (Daniel Lezcano <daniel.lezcano@free.fr>)
#
@dstroot
dstroot / install-redis.sh
Created May 23, 2012 17:56
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@dsibilly
dsibilly / gist:2992412
Created June 26, 2012 01:00
Node.js clustered HTTP server example
(function () {
'use strict';
var cluster = require('cluster'),
http = require('http'),
os = require('os'),
/*
* ClusterServer object
@furf
furf / _.deep.js
Created July 30, 2012 17:06
underscore.js mixin for plucking nested properties
_.mixin({
// Get/set the value of a nested property
deep: function (obj, key, value) {
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'),
root,
i = 0,
n = keys.length;
@jonlabelle
jonlabelle / string-utils.js
Last active October 30, 2023 20:33
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();
@nickjevershed
nickjevershed / Convert Google spreadsheet to JSON and save to S3
Created August 21, 2013 23:10
Converts Google spreadsheet to JSON and saves to an S3 bucket. Spreadsheet needs to be public or accessible with link.
#!/usr/bin/env python
import urllib2
import csv
import json
import boto
#Replace Google spreadsheet URL with your spreadsheet URL
url = "GOOGLE SPREADSHEET URL" + "&output=csv"
@dypsilon
dypsilon / highland_readdirp.js
Last active August 29, 2015 14:24
Recursive readdir using highland streams.
/**
* This function takes a directory path and returns a flat stream
* with stat objects + full file path in the .path property.
*/
var path = require('path');
var h = require('highland');
var readdir = h.wrapCallback(require('fs').readdir);
var stat = h.wrapCallback(require('fs').stat);