Skip to content

Instantly share code, notes, and snippets.

" We're running Vim, not Vi!
set nocompatible
" Enable syntax highlighting
syntax on
" Faster response
set ttyfast
" No bell sound
set visualbell
" Line numbering
set number
#!/usr/bin/env ruby -w
owner = 'pavel.kunc@gmail.com'
gems = %w{
merb
merb-action-args
merb-assets
merb-auth-core
merb-auth-more
merb-auth-slice-password
@pk
pk / config.ru
Created February 16, 2010 12:25
Merb config.ru for Unicorn, Passenger and others
begin
require ::File.expand_path('.bundle/environment', __FILE__)
rescue LoadError
require 'rubygems'
require 'bundler'
Bundler.setup
end
require 'merb-core'
Merb::Config.setup(:merb_root => ::File.expand_path(::File.dirname(__FILE__)),
@pk
pk / split_repo.bash
Created March 18, 2010 15:38
Extract directory from the GIT repo to the standalone GIT repo.
#!/bin/bash
FROM=$1
TO=$2
echo "Spliting '$TO' from '$FROM'"
git clone --no-hardlinks $FROM $TO
cd $TO
git filter-branch --subdirectory-filter $TO HEAD -- --all
git reset --hard
git gc --aggressive
git prune
# vim:set filetype=ruby:
begin
require ::File.expand_path('.bundle/environment', __FILE__)
rescue LoadError
require 'rubygems'
require 'bundler'
Bundler.setup
end
require 'merb-core'
#!/bin/bash
CURRENT_DIR=`pwd`
for dir in $(find $1 -type d -depth 1 -not -name "\.*");
do
cd $dir
if [ -f *.gem ]; then
rm -rv *.gem
fi
@pk
pk / test.js
Created December 7, 2010 16:58
Combining functional constructors/modules with the prototypal inheritance chain.
var sys = require('sys');
// Namespace
var o2 = function O2() {
var o = {};
// Core extensions
if (typeof Object.create !== 'function') {
Object.create = function(o) {
var F = function() {};
@pk
pk / TestiTunesAppDelegate.h
Created February 11, 2011 20:14
Adding custom PDF to the iTunes iBooks an proof of concept code.
//
// TestiTunesAppDelegate.h
// TestiTunes
//
// Created by Pavel Kunc on 11/02/2011.
// Copyright 2011 Fry-IT, Limited. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@pk
pk / PKRespondsToMatcher.h
Created February 16, 2011 17:17
OCHamcrest RespondsTo matcher: assertThat(anObject, respondsTo(@"someMethod:")); Instead of something like: assertTrue([anObject respondsToSelector:@selector(someMethod:)]);
//
// PKRespondsToMatcher.h
//
// Created by Pavel Kunc on 11/02/2011.
// Copyright 2011 Pavel Kunc. All rights reserved.
//
#import <OCHamcrestIOS/HCBaseMatcher.h>
#import <OCHamcrestIOS/HCDescription.h>
#import <objc/objc-api.h>
@pk
pk / list-issues.rb
Created April 10, 2011 11:59
Exports open issues for one project as CSV.
#!/usr/bin/env ruby
# Exports open issues for one project as CSV
#
# Usage:
# ./list-issues.rb > my-project-issues.csv
require 'net/http'
require 'json'
require 'csv'