Skip to content

Instantly share code, notes, and snippets.

View naokits's full-sized avatar

nao naokits

  • Individual Application Developer
View GitHub Profile
# Get path of currently-executing Ruby interpreter
# 現在実行中のRubyインタプリタのパスを取得する
require 'rbconfig'
ruby_path = File.join(Config::CONFIG["bindir"],
Config::CONFIG["RUBY_INSTALL_NAME"]+
Config::CONFIG["EXEEXT"])
p ruby_path // disp got ruby path
.
|-- .DS_Store
|-- Cache.app
| |-- Cache
| |-- Info.plist
| |-- MainWindow.nib
| `-- PkgInfo
|-- Documents
|-- Library
| |-- .DS_Store
//
// AsyncImageView.h
// Postcard
//
// Created by markj on 2/18/09.
// Copyright 2009 Mark Johnson. You have permission to copy parts of this code into your own projects for any use.
// www.markj.net
//
// See
@naokits
naokits / iOSDocumentMigrator.m
Created December 14, 2011 03:37 — forked from steipete/iOSDocumentMigrator.m
Helps migrating documents between iOS <= 5.0 and >= 5.0.1 to comply with Apple's iCloud guidelines. Follow @steipete on Twitter for updates.
#include <sys/xattr.h>
/// Set a flag that the files shouldn't be backuped to iCloud.
+ (void)addSkipBackupAttributeToFile:(NSString *)filePath {
u_int8_t b = 1;
setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}
/// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available.
+ (NSString *)legacyStoragePath {
@naokits
naokits / afnetwork_sample.m
Created December 14, 2011 04:49
AFNetworkingを使用したPDFファイルの受信処理サンプル。PDFファイルをサーバから受信中に総受信量(MB)を表示する。
//
// Created by Naoki TSUTSUI on 11/12/04.
//
/*
以下のコードは、実際に動作しているコードからの抜粋ですので、このままでは
動作しないかもしれません。fetchPdfFromServerのみ参考にしてください。
インジケータ表示にMBProgressHUDを使用していますが、必要なければ該当コード
を削除してください。
*/
@naokits
naokits / gist:1505121
Created December 21, 2011 07:51
「do not backup」 属性をディレクトリにマークするスニペットコード
- (void)sampleAddAttributeToFolder
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *baseDir = [self paperStandDocumentsBasePath];
NSError *error;
BOOL result = [fileManager createDirectoryAtPath:baseDir
withIntermediateDirectories:YES
attributes:nil
error:&error];
@naokits
naokits / xcode_valiables.rb
Created July 20, 2012 08:40
Display Xcode all valiables
#!/usr/bin/env ruby
##############################################################################
# Xcodeの環境変数表示
##############################################################################
puts "PATH = #{ENV['PATH']}"
puts "LANG = #{ENV['LANG']}"
puts "IPHONEOS_DEPLOYMENT_TARGET = #{ENV['IPHONEOS_DEPLOYMENT_TARGET']}"
puts "ACTION = #{ENV['ACTION']}"
@naokits
naokits / Utils.m
Created October 2, 2012 14:33
日付処理関連
//
// Utils.m
// StoreKitEventChecker
//
// Created by Naoki TSUTSUI on 12/01/30.
//
#import "Utils.h"
#include <objc/runtime.h>

Mountain Lion(OSX 10.8.x)でコンテキストメニューに同じアプリケーション名が複数表示される場合の対処法

なぜこういう現象が起きるのかについては不明(調べてない)

Terminalで以下を実行

cd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support
@naokits
naokits / gist:5252607
Last active December 15, 2015 11:19
iOSシュミレータを使用してAirPrintのデバッグを実機で行う方法

iOSシュミレータでAirPrintデバッグ

AirPrint対応のプリントを持っていなくても、iOSシュミレータを使用すればAirPrintのテストを実機(iDevice)で行うことが可能です。もちろん、iOSシュミレータでも同様です。

  • IOSシュミレータを起動します。
  • 「ファイル」メニューから「プリンタシュミレータを開く」を選択します。
    そうすると、「Printer Simulator」というアプリが起動し、仮想ドライバがシステムに追加されます。

システム環境設定の「プリンタとスキャン」で追加(+)ボタンをクリックすると、シミュレータによって追加されている下記のプリンタドライバのリストが確認できます。