Skip to content

Instantly share code, notes, and snippets.

View yamaya's full-sized avatar

Masayuki Yamaya yamaya

  • Sapporo, Hokkaido, Japan
View GitHub Profile
@alexkaessner
alexkaessner / custom-ios-simulator-statusbar.sh
Last active April 8, 2024 18:36
Customize iOS Simulator Status Bar (Xcode 11+)
$ xcrun simctl status_bar booted override --time "9:41" --batteryState charged --batteryLevel 100 --cellularMode active
@ishikawa
ishikawa / MyTextView.h
Created November 8, 2008 10:28
Cocoa custom text view with managing marked text
#import <Cocoa/Cocoa.h>
@interface MyTextView : NSView <NSTextInput, NSTextInputClient> {
NSMutableAttributedString *_text;
NSRange _selectedRange;
NSRange _markedRange;
}
@end
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
@Deco
Deco / deepcopy.lua
Created October 31, 2012 05:38
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO
@smiled0g
smiled0g / run_llama.sh
Last active June 21, 2023 00:45
Easy way to run local LLM for your M-series Macbooks
#!/usr/bin/env bash
# Install Git Large File Storage (LFS)
brew install git-lfs
git lfs install
# Download & Install Llama
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
LLAMA_METAL=1 make -j # build with Metal support for (M-series) Apple Silicon

How to use swift in your terminal

setup

First, install Xcode 6 beta.

And run it.

sudo xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer
@voluntas
voluntas / shiguredo_loadtest_tool_oribe_log.rst
Last active April 3, 2023 02:59
時雨堂 シナリオ負荷試験ツール Oribe 開発ログ

時雨堂 シナリオ負荷試験ツール Oribe 開発ログ

日時

2018-08-05

時雨堂

バージョン

18.08.0

url

https://shiguredo.jp/

depth

3

@neonichu
neonichu / source.lang.swift.md
Created February 13, 2015 21:44
Identifiers for Swift language entities
$ strings /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework/Versions/Current/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService|grep source.lang.swift
source.lang.swift.keyword
source.lang.swift.pattern
source.lang.swift.syntaxtype.argument
source.lang.swift.syntaxtype.parameter
source.lang.swift.attribute.availability
source.lang.swift.decl.extension
source.lang.swift.decl.var.parameter
source.lang.swift.stmt.brace
@markd2
markd2 / NSObject+setValuesForKeysWithJSONDictionary.h
Created July 18, 2013 13:44
Support files for Inside the Bracket Part 6, showing an actual use of the objective-C runtime API.
//
// NSObject+setValuesForKeysWithJSONDictionary.h
//
// Created by Tom Harrington on 12/29/11.
// Tweaked by Mark Dalrymple
//
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>