Skip to content

Instantly share code, notes, and snippets.

View steveatinfincia's full-sized avatar

Stephen Oliver steveatinfincia

View GitHub Profile
@steveatinfincia
steveatinfincia / codepoints-104.m
Last active August 29, 2015 14:07
Codepoints 1.0.4
-(void)drawBackgroundInRect:(NSRect)dirtyRect {
// if cellBackground does not exist, create it
if (!cellBackground) {
// NSImage ivar
cellBackground = [[NSImage alloc] initWithSize:dirtyRect.size];
[cellBackground lockFocus];
//cellGradient created elsewhere, just a basic gradient
[cellGradient drawInRect:dirtyRect angle:270];
[cellBackground unlockFocus];
}
@steveatinfincia
steveatinfincia / global-hotkeys-in-osx.m
Created October 2, 2014 03:52
Global Hotkeys in OS X
extern OSStatus
RegisterEventHotKey(
UInt32 inHotKeyCode,
UInt32 inHotKeyModifiers,
EventHotKeyID inHotKeyID,
EventTargetRef inTarget,
OptionBits inOptions,
EventHotKeyRef * outRef)
AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
@steveatinfincia
steveatinfincia / font-detection-codepoints.m
Last active August 29, 2015 14:07
Font detection in Codepoints
NSMutableAttributedString *displayedUnicodeString = [[NSMutableAttributedString alloc] initWithString:unicodeCharacter attributes:fontattributes];
[glyphView.character.textStorage setAttributedString:displayedUnicodeString];
// determine which font will actually be used by the character textview during rendering
NSFont *actualFont = [glyphView.character.textStorage attribute:NSFontAttributeName atIndex:0 effectiveRange:NULL];
// if it matches the users selected font, that font has a glyph for this character
BOOL characterFoundInFont = [selectedFont.fontName isEqualToString:actualFont.fontName];
@steveatinfincia
steveatinfincia / keybase.md
Created November 6, 2014 19:27
keybase.md

Keybase proof

I hereby claim:

  • I am steveatinfincia on github.
  • I am infincia (https://keybase.io/infincia) on keybase.
  • I have a public key whose fingerprint is 8C3C 99A6 863E CAD3 E484 2E7F 5314 35AC 9594 CAE0

To claim this, I am signing this object:

@steveatinfincia
steveatinfincia / gist:1684204
Created January 26, 2012 18:27
Signal bars drawn in code from Mi-Fi Monitor
//where the lowest point on the bar begins in the rect
float baseline = 3.0f;
// the vertical stopping point of each bar if it isn't "filled"
float cutoff = 5.0f;
// offset everything from the left by this amount
float offset = 1.0f;
//width of each bar
@steveatinfincia
steveatinfincia / gist:2712239
Created May 16, 2012 17:04
Dearly Tweeted's stream filter
import pycurl
import urllib
import json
import re
import sys
import datetime
from time import sleep
import sys
import threading
import logging
@steveatinfincia
steveatinfincia / gist:2759887
Created May 20, 2012 23:19
Dearlytweeted's streaming filter, updated to use tweepy and an actual reason to have a class :)
import urllib
import json
import re
import sys
import datetime
from time import sleep
import sys
import threading
import logging
import tweepy
@steveatinfincia
steveatinfincia / gist:2762699
Created May 21, 2012 14:41
Dearlytweeted's streaming filter, now with a config file for oauth credentials
import urllib
import json
import re
import sys
import os
import datetime
from time import sleep
import sys
import threading
import logging
@steveatinfincia
steveatinfincia / gist:2766443
Created May 22, 2012 03:48
Prototype slot machine logic for iOS
-(IBAction)spin:(id)sender {
int max = 4;
int min = 0;
int c1 = rand() % max + min;
int c2 = rand() % max + min;
int c3 = rand() % max + min;
[carousel1 scrollByNumberOfItems:250+c1 duration:3.5f];
[carousel2 scrollByNumberOfItems:250+c2 duration:4.0f];
@steveatinfincia
steveatinfincia / codepoints-106.crash
Created November 24, 2015 00:33
codepoints-106.crash
Process: Codepoints [65254]
Path: /Applications/Codepoints.app/Contents/MacOS/Codepoints
Identifier: com.infincia.codepoints
Version: 1.0.6 (106)
App Item ID: 499161264
App External ID: 651084151
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Codepoints [65254]
User ID: 501