Skip to content

Instantly share code, notes, and snippets.

View hirohitokato's full-sized avatar

Hirohito Kato hirohitokato

View GitHub Profile
// Playground - noun: a place where people can play
import Foundation
typealias Byte = UInt8
protocol GenericIntegerType: IntegerType {
init(_ v: Int)
init(_ v: UInt)
init(_ v: Int8)
@hirohitokato
hirohitokato / build_boost.sh
Last active August 29, 2015 14:16
Build boost libraries(1.57) for iOS/OS X.
# Shell script for building Boost C++ for iOS (armv7, armv7s, arm64), the iOS Simulator
# (i386, x86_64), and Mac OSX (i386, x86_64).
#
# Creates a set of universal libraries and a pseudo-framework to facilitate using
# Boost C++ in Xcode.
#
# To configure the script, define:
#
# BOOST_VERSION Boost C++ version (e.g. 1.57.0)
# BOOST_LIBS: which Boost C++ libraries to build
require 'coreaudio'
dev = CoreAudio.default_output_device
buf = dev.output_loop(44000)
line = ARGV[0]
puts line
44000.times do |t|
# buf[i] = 0x3FFF * rand()
import os
import csv
from subprocess import Popen, PIPE
from Foundation import NSMutableDictionary
build_number = os.popen4("git rev-parse --short HEAD")[1].read()
info_plist = os.environ['BUILT_PRODUCTS_DIR'] + "/" + os.environ['WRAPPER_NAME'] + "/Info.plist"
# Open the plist and write the short commit hash as the bundle version
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info_plist)
#import <UIKit/UIKit.h>
@interface UIWebView (Additions)
/*!
@abstract Enable/Disable the receiver from scrolling.
*/
@property (nonatomic, assign) BOOL webViewScrollEnabled;
/*
* BeginEnd.h
* GLBeginEnd
*
* Created by narumij on 10/05/18.
* Copyright 2010 narumij. All rights reserved.
*
*/
// http://d.hatena.ne.jp/narumij/20100518/1274190881
- (void)removeObjectForKey:(NSString*)key {
#if !TARGET_IPHONE_SIMULATOR
@synchronized(self) {
if (!deleteQueryDictionary) {
deleteQueryDictionary = [[NSMutableDictionary alloc]initWithObjectsAndKeys:
(id)kSecClassGenericPassword, (id)kSecClass,
key, (id)kSecAttrAccount,
(id)kSecMatchLimitAll, (id)kSecMatchLimit,
(id)kCFBooleanTrue, (id)kSecReturnAttributes,
nil];
/*
NSData+XMLParser
Simple XML Parser for iPhone
Usage:
* -I /usr/include/libxml2
* -L libxml2
@hirohitokato
hirohitokato / bench.cpp
Created February 21, 2010 13:26 — forked from qnighy/bench.cpp
元ネタ:C++ で気軽に時間測定がしたい http://d.hatena.ne.jp/iwiwi/20100221/1266682598 ブロック内で標準エラー出力へ出力していたり,入れ子的に使ったりすると表示がおかしなことになってしまう問題の対策コード http://twitter.com/qnighy/status/9423778596
/*
* 元ネタ:C++ で気軽に時間測定がしたい
* http://d.hatena.ne.jp/iwiwi/20100221/1266682598
*
* ブロック内で標準エラー出力へ出力していたり,入れ子的に使ったりすると,
* 表示がおかしなことになってしまうという問題への対策を施したコード
* Twitter: http://twitter.com/qnighy/status/9423778596
*/
#include <cstdio>
#include <sys/time.h>