Skip to content

Instantly share code, notes, and snippets.

function spreadsheetHeaderArray(length) {
var i, result = [], characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
for (i = 0; i < length; i += 1) {
result[i] = (i > 25) ? result[i - 26] + characters[i % 26] : characters[i % 26];
}
return result;
}
~/Development/ObjFW/objfw% make
Entering directory src.
Entering directory exceptions.
Leaving directory exceptions.
Leaving directory src.
Entering directory utils.
Leaving directory utils.
Entering directory tests.
Entering directory plugin.
Leaving directory plugin.
~/Development/ObjFW/objfw% make TEST_LAUNCHER=gdb tests
Entering directory src.
Entering directory exceptions.
Leaving directory exceptions.
Leaving directory src.
Entering directory tests.
Entering directory plugin.
Leaving directory plugin.
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
function shouldDecrement(current, target, length) {
var directDist, decrementDist;
directDist = target - current;
decrementDist = length - target + current;
if (Math.abs(directDist) < decrementDist)
if (directDist > 0)
return false;
#include <stdio.h>
int main() {
int num = 0;
int i;
int counter;
do {
counter = 0;
num++;
#compdef _files
fuzzy_complete() {
words=( ${(z)BUFFER} );
pieces=( ${(s:/:)words[-1]} );
globpt=${(j:*:)${(s::)pieces[-1]}};
matches=( $pieces[1,-2]/*${~globpt}* );
(( $#matches == 1 )) && BUFFER="${words[1,-2]} ${matches[1]}" && CURSOR=$#BUFFER || zle -M "Completions: $matches"
};
@jonvuri
jonvuri / gist:3691002
Created September 10, 2012 13:43
Homebrew ffmpeg install issue
% HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install --HEAD pigoz/mplayer2/mplayer2
==> Installing mplayer2 dependency: ffmpeg
==> Downloading http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/ffmpeg-0.11.1.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/ffmpeg-0.11.1.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
./configure --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
install prefix /usr/local/Cellar/ffmpeg/0.11.1
source path .
C compiler cc
@jonvuri
jonvuri / gist:3714253
Created September 13, 2012 13:26
Looking for someone to host al2o3cr

jrajav here, I wrote and hosted al2o3cr for a while. It's a bot in #ruby that interprets code on-the-fly in the channel, like most language channels on Freenode have. Unfortunately, I can't host it any longer. My work machine was the only one that could handle it, and that now has to host a scaling utility as well, which interferes with the VM the bot was on. If anyone else has a Linux box on which they can host and maintain the bot, please let me know at jrajav at gmail dot com and I'll tell you how to get it set up. It's pretty simple, and reasonably secure. Everything takes place in a chroot with below-root access. Still, I can't guarantee that it won't blow your system up. If security is important (like it was for me), you still might want to run it in a VM or on a more disposable machine.

@jonvuri
jonvuri / .vimrc
Created September 19, 2012 13:02
runtime bundle/pathogen/autoload/pathogen.vim
call pathogen#infect()
" Die
set nocompatible
" Make commands like yy, D, p, etc. work with the OSX clipboard
set clipboard=unnamed
" Make the mouse work
could not source "$VIM\vimrc"
sourcing "$HOME\_vimrc"
Searching for "autoload/pathogen.vim" in "C:/MinGW/msys/1.0/home/U01
60100/vimfiles,c:\Program Files (x86)\Vim/vimfiles,c:\Program Files
(x86)\Vim\vim73,c:\Program Files (x86)\Vim/vimfiles/after,C:/MinGW/msys
/1.0/home/U0160100/vimfiles/after"
Searching for "C:/MinGW/msys/1.0/home/U0160100/vimfiles\autoload/pat