Skip to content

Instantly share code, notes, and snippets.

@inky
inky / HurrDurr.h
Created April 12, 2009 01:32
Trying to learn Objective-C. What looks like trivial code is leaking memory. [UPDATE: Fixed. Garbage collection appears to be turned off by default. What. the. fuck.]
#import <Cocoa/Cocoa.h>
@interface HurrDurr : NSObject
{
NSString *caption;
}
- (NSString*) caption;
% TeX usually assumes that . marks the end of a sentence.
% To fix the spacing for a non–sentence-terminating full stop:
... Smith et al.\ claim that...
% A full stop after a capital letter is assumed to be part of
% an abbreviation. To fix this:
... from Diablo II\@. This is...
% From: http://john.regehr.org/latex/
@inky
inky / loremipsum.tex
Created April 21, 2009 18:41
\loremipsum
\def\loremipsum{Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur pharetra odio id neque. Vestibulum augue lorem, fermentum at,
sollicitudin sit amet, mattis eu, sapien. Ut erat lorem, condimentum
condimentum, fringilla et, pellentesque eget, sem. Mauris vel lectus sit amet
urna aliquet adipiscing. Vestibulum ante ipsum primis in faucibus orci luctus
et ultrices posuere cubilia Curae; Mauris ipsum ante, fringilla a, pharetra
auctor, sagittis sit amet, lacus. Nulla suscipit, nisi tristique eleifend
lacinia, lacus felis placerat nibh, non volutpat nibh erat ac magna. Donec
blandit, urna in ornare convallis, purus velit dignissim nulla, quis egestas
neque felis non odio. Morbi magna nulla, eleifend vitae, tempus vitae,
@inky
inky / strange warning when merging after a pull.sh
Created May 5, 2009 02:26
warning: refname 'user/master' is ambiguous.
$ git remote add -f user git://github.com/user/repo.git
$ git checkout -b user/repo
$ git pull user master:b4dc0ff33
...
$ git checkout master
$ git merge user/master
warning: refname 'user/master' is ambiguous.
warning: refname 'user/master' is ambiguous.
Updating 0123456..b4dc0ff
Fast forward
lol hi
A small selection of printable character ranges (UTF-8)
--------- ----- -----------
range total description
(hex) (dec)
--------- ----- -----------
ONE BYTE (0000-007F)
0021-0025 5 basic latin (excluding & < > and space)
@inky
inky / sexagenary.py
Created June 15, 2009 23:02
Determine the current year in the Chinese sexagenary cycle.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Determine the current year in the Chinese sexagenary cycle.
"""
import datetime
EN_NAMES = (('Yang', 'Yin'),
('Wood', 'Wood', 'Fire', 'Fire', 'Earth', 'Earth',
@inky
inky / hacker.key
Created July 5, 2009 18:12
hacker.key
v4sw6YUHChw4ln6pr5POck4ma5u6MLw2DXm7l5Ui2e6t4Mb6GADen5+7g4ORAPa2Xs4MSr2p-6
#import <Cocoa/Cocoa.h>
@interface BlagnargView : NSView {
}
@end
-- My first ever useful haskell script:
-- a solution to the first problem on projecteuler.net (easy)
-- <spoiler>
euler001 :: Int
euler001 = sum [x | x <- [1..999], mod x 3 == 0 || mod x 5 == 0]
-- </spoiler>