Skip to content

Instantly share code, notes, and snippets.

View timdp's full-sized avatar

Tim De Pauw timdp

View GitHub Profile
@timdp
timdp / sanitize.js
Created December 2, 2014 17:44
Simple self-contained HTTP sanitizer
var sanitize = (function() {
var re = /(.*?)<(\/?)\s*([A-Za-z]+)[^>]*>/mg;
var blockElements = ['br', 'div', 'p', 'blockquote'];
var inlineBlockElements = ['img'];
var sanitize = function(input) {
input = input.replace(/\s+/g, ' ');
var out = '';
var index = 0;
@timdp
timdp / parseFontCss
Created January 7, 2015 13:57
Self-contained Web Font CSS parser
var parseFontCss = (function() {
var WEIGHT_MAP = {
lighter: 300,
normal: 400,
bold: 700,
bolder: 800
};
var getFontFaceBlocks = function(css) {
var reFontFace = /@font-face\s*\{([^}]*)\}/g;
@timdp
timdp / Main.as
Created January 14, 2015 14:05
Animated path as mask for an image
package {
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
public class Main extends Sprite {
public const POINTS:uint = 15;
public const OUTER_SCALE:Number = 0.9;
@timdp
timdp / .bashrc
Created February 1, 2015 13:32
.bashrc for use with nvmw
export PATH="$PATH:~/.nvmw/latest"
alias npm='node ~/.nvmw/latest/node_modules/npm/bin/npm-cli.js'
@timdp
timdp / blog.md
Created February 7, 2015 22:14
io.js week van 6 februari 2015

io.js: week van 6 februari 2015

Atom & nw.js adopteren io.js, Linux Tracing en veel meer.

Voortaan posten we elke vrijdag een wekelijkse update over de activiteit rond io.js.

We blikten terug op de bijdragen in de maand januari en stelden vast dat dit de op twee na meest actieve maand in de geschiedenis van Node was (294 commits). Bovendien was het de meest actieve maand in bijna drie jaar (308 commits in februari 2012). Gezien de huidige evolutie in het aantal bijdragen verwachten we dat februari nóg actiever wordt.

  1. We brachten versie 1.1.0 uit. Bekijk de wijzigingen.
  2. Simplified Stream Construction (vereenvoudigde streamconstructie) door Sam Newman wordt voortaan meegeleverd.
@timdp
timdp / s3cmd.cmd
Created June 10, 2015 07:53
s3cmd wrapper for Windows
@echo off
setlocal
"%~dp0..\python" "%~dp0s3cmd" %*
endlocal
@timdp
timdp / mopidy-twitter.sh
Created September 24, 2015 11:34
/etc/init.d/mopidy-twitter
#!/bin/bash
#
# An init.d script for running a Node.js process as a service using Forever as
# the process monitor. For more configuration options associated with Forever,
# see: https://github.com/nodejitsu/forever
#
# This was written for Debian distributions such as Ubuntu, but should still
# work on RedHat, Fedora, or other RPM-based distributions, since none of the
# built-in service functions are used. So information is provided for both.
#
@timdp
timdp / tweet_rhythm.php
Created May 30, 2012 14:10
Tweets rhythm chart
<?php
// Plots a user's tweet rhythm using Google Chart Tools
// Limited to about 3200 tweets by the Twitter API
// Hacked together by @tmdpw on 2012-05-30
if (count($argv) != 3) {
die("Usage: php $argv[0] USERNAME FILENAME");
}
@timdp
timdp / tweets_per_day.php
Created May 30, 2012 13:47
Tweets per day chart
<?php
// Plots a user's daily tweet count using Google Chart Tools
// Limited to about 3200 tweets by the Twitter API
// Hacked together by @tmdpw on 2012-05-30
if (count($argv) != 3) {
die("Usage: php $argv[0] USERNAME FILENAME");
}
@timdp
timdp / analyze-twitter-archive.php
Last active December 11, 2015 06:59
Twitter Archive Analyzer
<?php
// Twitter Archive Analyzer
// @tmdpw, 2013-01-18
// https://github.com/timdp
// Instructions:
// 1. Request your Twitter archive from twitter.com.
// 2. Extract the zip file you obtained.
// 3. Run this script with the extraction path as its argument.