Skip to content

Instantly share code, notes, and snippets.

@morganwilde
morganwilde / ios-font-iterator.m
Created May 3, 2014 09:00
A quick hack to see how all the fonts in iOS look like live
CGFloat height = 20;
CGRect frameMessage = CGRectMake(0, 0, self.view.bounds.size.width, height);
MessageView *messageView;// = [[MessageView alloc] initWithFrame:frameMessage message:@"Font list" font:@"Thonburi-Bold"];
// Iterate over all the fonts in iOS
NSArray *fonts = [NSArray arrayWithObjects:@"Thonburi-Bold", @"Thonburi", @"Thonburi-Light", @"SnellRoundhand-Black", @"SnellRoundhand-Bold", @"SnellRoundhand", @"AcademyEngravedLetPlain", @"MarkerFelt-Thin", @"MarkerFelt-Wide", @"Avenir-Heavy", @"Avenir-Oblique", @"Avenir-Black", @"Avenir-Book", @"Avenir-BlackOblique", @"Avenir-HeavyOblique", @"Avenir-Light", @"Avenir-MediumOblique", @"Avenir-Medium", @"Avenir-LightOblique", @"Avenir-Roman", @"Avenir-BookOblique", @"GeezaPro-Bold", @"GeezaPro", @"GeezaPro-Light", @"ArialRoundedMTBold", @"Trebuchet-BoldItalic", @"TrebuchetMS", @"TrebuchetMS-Bold", @"TrebuchetMS-Italic", @"ArialMT", @"Arial-BoldItalicMT", @"Arial-ItalicMT", @"Arial-BoldMT", @"Marion-Regular", @"Marion-Italic", @"Mar
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@twosixcode
twosixcode / gist:1988097
Created March 6, 2012 18:40
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }