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
/* | |
AUTO-COMPLETE SNIPPETS FOR GLSL WITHIN VISUAL CODE STUDIO | |
Lewis Lepton | |
https://lewislepton.com | |
useful places that i grabbed info from | |
http://www.shaderific.com/glsl | |
https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language | |
plus various other papers & books | |
*/ |
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
static Boolean PSPDFCaseInsensitiveEqualCallback(const void *a, const void *b) { | |
id objA = (__bridge id)a, objB = (__bridge id)b; | |
Boolean ret = FALSE; | |
if ([objA isKindOfClass:NSString.class] && [objB isKindOfClass:NSString.class]) { | |
ret = ([objA compare:objB options:NSCaseInsensitiveSearch|NSLiteralSearch] == NSOrderedSame); | |
}else { | |
ret = [objA isEqual:objB]; | |
} | |
return ret; | |
} |
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
{ | |
/* Keybindings for emacs emulation. Compiled by Jacob Rus. | |
* | |
* To use: copy this file to ~/Library/KeyBindings/ | |
* after that any Cocoa applications you launch will inherit these bindings | |
* | |
* This is a pretty good set, especially considering that many emacs bindings | |
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and | |
* perhaps a few more, are already built into the system. | |
* |
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
/* http://en.wikipedia.org/wiki/GBK */ | |
size_t fixGBK(const char *str, size_t len) | |
{ | |
const unsigned char *string = (const unsigned char *)str; | |
size_t idx = 0; | |
for (idx = 0; idx < len; idx++) { | |
int val = string[idx], val2; | |
if (val < 128) | |
continue; | |
if (idx + 1 >= len) |
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
.PHONY: test clean | |
all: bootloader.img | |
bootloader.img: bootloader.asm | |
nasm -f bin -o bootloader.img bootloader.asm | |
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
<?php | |
class File_Streamer | |
{ | |
private $_fileName; | |
private $_contentLength; | |
private $_destination; | |
public function __construct() | |
{ | |
if (!isset($_SERVER['HTTP_X_FILE_NAME']) |
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
CATextLayer *textLayer = [CATextLayer layer]; | |
textLayer.backgroundColor = [UIColor whiteColor].CGColor; | |
textLayer.frame = CGRectMake(20, 20, 200, 100); | |
textLayer.contentsScale = [[UIScreen mainScreen] scale]; | |
CTFontRef fontFace = CTFontCreateWithName((__bridge CFStringRef)(@"HelfaSemiBold"), 24.0, NULL); | |
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; | |
[attributes setObject:(__bridge id)fontFace forKey:(NSString*)kCTFontAttributeName]; | |
[attributes setObject:[UIColor blackColor] forKey:(NSString*)kCTForegroundColorAttributeName]; | |
NSAttributedString *attrStr = [[NSAttributedString alloc] initWithString:@"Lorem Ipsum" attributes:attributes]; |
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
git init # 初始化本地git仓库(创建新仓库) | |
git config --global user.name "xxx" # 配置用户名 | |
git config --global user.email "[email protected]" # 配置邮件 | |
git config --global color.ui true # git status等命令自动着色 | |
git config --global color.status auto | |
git config --global color.diff auto | |
git config --global color.branch auto | |
git config --global color.interactive auto | |
git config --global --unset http.proxy # remove proxy configuration on git | |
git clone git+ssh://[email protected]/VT.git # clone远程仓库 |
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
public class ArrayDataSource<CellType: UIView, ItemType> { | |
private var items: [ItemType] | |
private var cellReuseIdentifier: String | |
private var configureClosure: (CellType, ItemType) -> Void | |
private var proxy: DataSourceProxy! | |
private unowned var view: UIView | |
public init(view: UIView, items: [ItemType], cellReuseIdentifier: String, configureClosure: (CellType, ItemType) -> Void) { | |
self.items = items | |
self.cellReuseIdentifier = cellReuseIdentifier |
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 <stdio.h> | |
// xcrun clang -g -Wall -Werror -fprofile-instr-generate -fcoverage-mapping -o testprof testprof.m | |
// ./testprof | |
// xcrun llvm-profdata merge -o testprof.profdata default.profraw | |
// xcrun llvm-cov show ./testprof -instr-profile=testprof.profdata testprof.m | |
static int DoSomething (int value) { | |
if (value == 55) { |
NewerOlder