Skip to content

Instantly share code, notes, and snippets.

View ytlvy's full-sized avatar

Yt ytlvy

View GitHub Profile
@ytlvy
ytlvy / glsl.json
Created September 2, 2023 06:25 — forked from lewislepton/glsl.json
GLSL snippets for visual studio code/kode studio
/*
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
*/
{"lastUpload":"2020-08-13T03:57:34.227Z","extensionVersion":"v3.4.3"}
atomSync
@ytlvy
ytlvy / CaseInsensitiveDictionary.m
Created February 23, 2017 02:46 — forked from steipete/CaseInsensitiveDictionary.m
Implemented as a category on NSDictionary.
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;
}
@ytlvy
ytlvy / DefaultKeyBinding.dict
Created December 21, 2016 01:40
xcode keybindings for emacs emulation
{
/* 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.
*
@ytlvy
ytlvy / isgbk.c
Created November 14, 2016 09:08 — forked from markqiu/isgbk.c
判断一个字串是否是GBK编码
/* 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)
@ytlvy
ytlvy / Makefile
Created October 13, 2016 01:46 — forked from mafice/Makefile
build bochs on Mac OS X
.PHONY: test clean
all: bootloader.img
bootloader.img: bootloader.asm
nasm -f bin -o bootloader.img bootloader.asm
@ytlvy
ytlvy / Streamer.php
Created September 28, 2016 04:05 — forked from gpbmike/Streamer.php
php backend for streaming file upload with XMLHttpRequest
<?php
class File_Streamer
{
private $_fileName;
private $_contentLength;
private $_destination;
public function __construct()
{
if (!isset($_SERVER['HTTP_X_FILE_NAME'])
@ytlvy
ytlvy / gist:bf52070533e23435d9a9c2744f7a194c
Created September 21, 2016 04:06 — forked from mluton/gist:5323538
Put an NSAttributedString into a CATextLayer. This works in iOS 5.
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];
@ytlvy
ytlvy / git_toturial
Created August 4, 2016 02:04 — forked from guweigang/git_toturial
git命令大全
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远程仓库