Skip to content

Instantly share code, notes, and snippets.

View adamvr's full-sized avatar

Adam Rudd adamvr

  • Cologne, Germany
View GitHub Profile
@adamvr
adamvr / profile.js
Created May 13, 2013 14:08
Profiling example
app.get('/:lang/:comparison', index.selectLang
, comparison.parseRivalNames
, profile.start('db')
, comparison.loadRivals
, comparison.loadEmbedded
, comparison.calculateRivalProperties
, comparison.loadSnippets
, comparison.loadCategories
, profile.end('db')
, comparison.choosePictures
@adamvr
adamvr / .gitignore
Last active April 25, 2019 08:28
Clearing mqtt retained messages using mqttjs
node_modules
@adamvr
adamvr / document-model.js
Last active December 15, 2015 05:59
CMS design notes
var mongoose = require('mongoose');
// TODO: Take schema out so we can add methods to it
Document = module.exports.Document =
mongoose.model('Document', mongoose.Schema({
title: String,
text: String,
tags: [String],
type: { type: String, default: 'markdown' },
createdAt: { type: Date, default: Date.now }
@adamvr
adamvr / .gitignore
Last active December 14, 2015 19:18
Quick and dirty http mqtt publisher
node_modules
@adamvr
adamvr / .gitingore
Last active December 14, 2015 16:28
Two clients interfere with each other since they have the same client ID
node_modules
@adamvr
adamvr / .gitignore
Last active December 14, 2015 15:19
memory consumption of MQTT.js client
node_modules
@adamvr
adamvr / .gitignore
Last active December 14, 2015 14:09
mqtt.js benching
node_modules
@adamvr
adamvr / bench-array.js
Last active December 14, 2015 13:08
Buffer concat vs array concat vs buffer write performance
var array = [];
for (var i = 0; i < 10000; i += 1) {
array = array.concat(['test']);
}
var buffer = new Buffer(array);
@adamvr
adamvr / fiddle.css
Created December 3, 2012 11:39
Fiddlin
@import url('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
@adamvr
adamvr / chapterify.sh
Created September 13, 2012 09:18
chapterify a directory of mp3s
#!/bin/sh
# Chapters
for chap in *
do
cd "$chap"
chapterFile="$chap".mp3
tmp=tmp.mp3
# Files
for file in *.mp3