This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSWorkspace+OpenFileOnLine.h" | |
NSString *kSublimeText2Identifier = @"com.sublimetext.2"; | |
NSString *kSublimeText3Identifier = @"com.sublimetext.3"; | |
NSString *kMacVimIdentifier = @"org.vim.MacVim"; | |
NSString *kTextmateIdentifier = @"com.macromates.textmate"; | |
NSString *kTextmate2Identifier = @"com.macromates.textmate.preview"; | |
NSString *kBBEditIdentifier = @"com.barebones.bbedit"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSUInteger const mmWidth = 10; | |
CGSize const boundsSize = { mmWidth*10, 50 }; | |
UIGraphicsBeginImageContextWithOptions(boundsSize, NO, 0); | |
self.view.contentMode = UIViewContentModeTop; | |
[[UIColor blackColor] setFill]; | |
UIRectFill((CGRect) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "AppKit" | |
@NSString { | |
- trimmed `self stringByTrimmingCharactersInSet: NSCharacterSet whitespaceAndNewlineCharacterSet` | |
} | |
@NSBlock { | |
- applicationDidFinishLaunching: app `self call` | |
} | |
@NSApplication { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout ::= rules. | |
rules ::= rule. | |
rules ::= rules rule. | |
rule ::= orientation superview connection view connection superview | |
view ::= LBRACKET className selectors predicateList RBRACKET | |
LBRACE layout RBRACE. | |
selectors ::= selector. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|-(>=20)-[UILabel#labelA (==100)] - 10 - [UILabel#labelB maximumLines=0]-| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)_setVolumeBezelVisible:(BOOL const)aVisible | |
{ | |
mach_port_t (*springBoardServerPort)() = dlsym(RTLD_DEFAULT, "SBSSpringBoardServerPort"); | |
void (*setSystemVolumeHUDEnabled)(mach_port_t, const char *audioCategory, Boolean) = | |
dlsym(RTLD_DEFAULT, "SBSetSystemVolumeHUDEnabled"); | |
if(!springBoardServerPort || !setSystemVolumeHUDEnabled) | |
return; | |
mach_port_t sbPort = springBoardServerPort(); | |
if(!sbPort) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint16_t itoa(int16_t num, unsigned char *buf, uint16_t maxlen) | |
{ | |
int ofs = maxlen; | |
unsigned char *head = buf; | |
int16_t abs_num = abs(num); | |
do { | |
*head++ = "0123456789"[abs_num % 10]; | |
abs_num /= 10; | |
} while(abs_num != 0); | |
if(num < 0) *head++ = '-'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
#include "usart.h" | |
#include "hardware.h" | |
#include "interrupt.h" | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <stdarg.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "uint128.h" | |
#include "assert.h" | |
#include <string.h> | |
#include <stdio.h> | |
static inline void uint128_set_bit(uint128_t a, uint8_t idx) | |
{ | |
assert(idx < 128); | |
a[idx/8] |= 1 << (7 - idx%8); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::libc; | |
use std::cast::transmute; | |
type Id = libc::uintptr_t; | |
type Sel = libc::uintptr_t; | |
#[link(name = "objc")] | |
extern { | |
fn sel_registerName(sel: &str) -> Sel; | |
fn objc_msgSend(object: Id, sel: Sel, ...) -> libc::uintptr_t; |
OlderNewer