Skip to content

Instantly share code, notes, and snippets.

View tanb's full-sized avatar
:shipit:
🐁🗯

Tomonori Tanabe tanb

:shipit:
🐁🗯
View GitHub Profile
- App Entry Point
app_event_loop()
- Bluetooth module's sniff interval
void app_comm_set_sniff_interval(const SniffInterval interval)
SniffInterval app_comm_get_sniff_interval(void)
enum SniffInterval {
SNIFF_INTERVAL_NORMAL
SNIFF_INTERVAL_REDUCED
@tanb
tanb / Avoidance Of CocoaPods Installation Ambush.md
Last active June 2, 2016 17:34
Avoidance Of CocoaPods Installation Ambush
$ brew install rbenv
$ brew install ruby-build
$ brew install rbenv-gemset
$ brew install xcproj
$ rbenv install -l
$ rbenv install 2.3.1
$ rbenv versions
$ rbenv shell system
$ rbenv shell 2.3.1
@tanb
tanb / flymake-swift.el
Last active August 29, 2015 14:08
flymake - swift
(when (require 'flymake nil 'noerror)
;; ignore syntax check error http://d.hatena.ne.jp/sugyan/20100705/1278306885
(defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted)
(setq flymake-check-was-interrupted t))
(ad-activate 'flymake-post-syntax-check)
;; swift
(defvar swift-sdk-path "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk")
(defvar swift-configure-target "i386-apple-ios8.1")
(defun flymake-swift-init ()
@tanb
tanb / gist:02808db1e86b820f4fb3
Created August 3, 2014 08:10
xattr to display sjis on quicklook
$ xattr -p com.apple.TextEncoding ~/Desktop/myfile.txt
xattr: /Users/tanb/Desktop/myfile.txt: No such xattr: com.apple.TextEncoding
$ xattr -p com.apple.TextEncoding ~/Desktop/myfile.txt
SHIFT_JIS;2561
+ (void)initialize
{
_singleton = @[@"hoge",
@(100),
[UIImage new]];
}
+ (id)getSettingsAtIndex:(NSUInteger)index
{
NSArray *settings = [[NSArray alloc] initWithArray:_singleton copyItems:YES];
@tanb
tanb / launchctl
Last active August 29, 2015 14:00
wifi接続の変更を監視してscriptを実行
# root所有にしておかないと実行されない
sudo chown root ~/Library/LaunchAgents/me.tanb.sample.plist
sudo launchctl load ~/Library/LaunchAgents/me.tanb.sample.plist
// MyViews.xib に複数のViewをいれました
NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"MyViews" owner:nil options:nil];
// RestorationIDに適当な名前をつけておいて取り出しました
__block UIView *targetView = nil;
[nibContents enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
if ([view.restorationIdentifier isEqualToString:@"MyView"]) {
*stop = YES;
targetView = (UIView *)view;
}
@tanb
tanb / gist:11094235
Created April 19, 2014 19:06
FileThumbnail
NSArray *fileURLs = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:self.url
includingPropertiesForKeys:[NSArray array]
options:0
error:nil];
[fileURLs enumerateObjectsUsingBlock:^(NSURL *fileURL , NSUInteger idx, BOOL *stop) {
NSImage *elementIcon = [[NSWorkspace sharedWorkspace] iconForFile:[fileURL path]];
CFStringRef fileExtension = (__bridge CFStringRef)[fileURL pathExtension];
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
if (UTTypeConformsTo(fileUTI, kUTTypeImage)) {
@tanb
tanb / gist:8051900
Last active December 31, 2015 22:09
.NET 4.5 async/awaitについて
  • Task typeを返す非同期メソッドを呼び出す
  • 非同期処理の戻り値はTaskクラスのResultにセットされる.awaitがそれを返している.
  • 非同期処理が終了するとawait以降のコードに処理が戻る
// これと
var worker = await TplWorker.DoWorkAsync();
ShowResult(worker);
@tanb
tanb / .lldbinit
Created December 5, 2013 05:47
~/.lldbinitです
script import os, sys
# So that ~/lldbutils.py takes precedence.
script sys.path[:0] = [os.path.expanduser('~')]
script import lldbutils
command script add -f lldbutils.print_data_as_string_function pdas