Skip to content

Instantly share code, notes, and snippets.

View pfleidi's full-sized avatar

Sven Pfleiderer pfleidi

View GitHub Profile
Operating system: Mac OS X
10.8.2 12C60
CPU: x86
GenuineIntel family 6 model 37 stepping 5
4 CPUs
Crash reason: EXC_BAD_ACCESS / KERN_PROTECTION_FAILURE
Crash address: 0x58
Thread 0 (crashed)
require 'stringio'
require 'benchmark/ips'
list = 1...10_000
Benchmark.ips do |x|
x.config(:time => 10, :warmup => 2)
x.report('String#<<') do
s = ''
@pfleidi
pfleidi / wc.rb
Created April 3, 2012 17:07
Stupid implementation of the unix tool wc in Ruby
#!/usr/bin/env ruby
require 'optparse'
options = {}
# parse commandline options
OptionParser.new do |opts|
opts.banner = "Usage: #{__FILE__} [-lmw] [file]"
@pfleidi
pfleidi / wordpressdotcom.rb
Created March 31, 2012 11:57
Slightly modified version of stock wordpress -> jekyll importer
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'yaml'
require 'time'
module Jekyll
# This importer takes a wordpress.xml file, which can be exported from your
@pfleidi
pfleidi / timeoutclient.js
Created May 28, 2011 13:39
Create custom timeouts for Node.js http.ClientRequest
var http = require("http");
var TIMEOUT_VALUE = 2020;
var options = {
host: 'localhost',
port: 3000,
path: '/',
method: 'GET'
};
@pfleidi
pfleidi / gvimrc
Created April 13, 2011 10:08
Map Command-# to switch tabs
" Map Command-# to switch tabs
map <D-0> 0gt
imap <D-0> <Esc>0gt
map <D-1> 1gt
imap <D-1> <Esc>1gt
map <D-2> 2gt
imap <D-2> <Esc>2gt
map <D-3> 3gt
imap <D-3> <Esc>3gt
map <D-4> 4gt
@pfleidi
pfleidi / AndroidManifest.xml
Created March 9, 2011 13:27
The generated android manifest of a titanium mobile application
<?xml version="1.0" ?><manifest android:versionCode="1" android:versionName="1" package="com.mwaysolutions.barcodeexample" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="4"/>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<!-- TI_MANIFEST -->
<application android:debuggable="false" android:icon="@drawable/appicon" android:label="Barcode Example" android:name="BarcodeExampleApplication">
<activity android:configChanges="keyboardHidden|orientation" android:label="Barcode Example" android:name=".BarcodeExampleActivity" android:theme="@style/Theme.Titanium">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
@pfleidi
pfleidi / template.tex
Created February 9, 2011 00:11
My basic LaTeX template
\documentclass[11pt,titlepage,a4paper,english]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{underscore}
\usepackage{caption}
\usepackage{listings}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
@pfleidi
pfleidi / gridstoretest.js
Created December 19, 2010 22:41
Example using the mongodb-native module and step to write to mongodb gridfs
var Db = require('mongodb').Db,
Connection = require('mongodb').Connection,
Server = require('mongodb').Server,
GridStore = require('mongodb').GridStore,
Step = require('step'),
Sys = require('sys'),
Fs = require('fs');
var database;
http://julien51.github.com/socket-sub/maps
http://saber-tooth-moose-lion.no.de/
http://rallarpojken.no.de/
http://rumpetroll.com/