Skip to content

Instantly share code, notes, and snippets.

@KAMEDAkyosuke
KAMEDAkyosuke / log.h
Created December 22, 2011 05:43
log util for android and others
#ifndef LOG_H
#define LOG_H
#ifdef ANDROID
# include <android/log.h>
# ifndef ANDROID_LOG_TAG
# ANDROID_LOG_TAG "NATIVE_LOG"
# endif /* ANDROID_LOG_TAG */
# ifndef ANDROID_LOG_LEVEL
@KAMEDAkyosuke
KAMEDAkyosuke / concat_libs.sh
Created December 22, 2011 05:54
concatenate static libraries for iOS device and simulator
#!/bin/sh
LIBNAME=$1
mkdir -p usr/local/lib
lipo -create \
armv6/usr/local/lib/$1.a \
armv7/usr/local/lib/$1.a \
i386/usr/local/lib/$1.a \
@KAMEDAkyosuke
KAMEDAkyosuke / make_clone.sh
Created December 22, 2011 05:57
clone vmware image for `VMWare Fusion 3.x`
#!/bin/sh
SOURCE=$1
CLONE=$2
PREFIX='.vmwarevm'
cp -rf $SOURCE $CLONE
cd $CLONE
SOURCE=$(echo $SOURCE | sed -e s/\\$PREFIX//)
public static final void cleanupView(final ViewGroup viewGroup, final View view) {
if(view != null){
view.setBackgroundDrawable(null);
if(view instanceof ImageView) {
ImageView v = (ImageView)view;
v.setImageDrawable(null);
}
else if(view instanceof ImageButton) {
ImageButton v = (ImageButton)view;
v.setImageDrawable(null);
@KAMEDAkyosuke
KAMEDAkyosuke / gist:5697303
Created June 3, 2013 10:19
これで書けば http-sync を普通に node モジュールっぽく使える。
#!/bin/sh
mkdir node_modules
cd node_modules
git clone https://github.com/dhruvbird/http-sync.git
cd http-sync
node-gyp configure
node-gyp build
cp build/Release/curllib.node .
@KAMEDAkyosuke
KAMEDAkyosuke / gist:7577678
Last active December 28, 2015 23:19
AAC のハードウェアエンコーダーをサポートしているかどうかのチェック。
- (BOOL)isAACHardwareEncoderAvailable
{
OSStatus status;
UInt32 size;;
UInt32 encoderSpecifier = kAudioFormatMPEG4AAC;
status = AudioFormatGetPropertyInfo(kAudioFormatProperty_Encoders,
sizeof(encoderSpecifier),
&encoderSpecifier,
&size);
check_osstatus(status, @"AudioFormatGetPropertyInfo fail");
@KAMEDAkyosuke
KAMEDAkyosuke / env.txt
Last active August 29, 2015 14:15
xcode env
COPY_PHASE_STRIP=NO
JAVA_ZIP_FLAGS=-urg
SDK_PRODUCT_BUILD_VERSION=12B411
HEADERMAP_INCLUDES_PROJECT_HEADERS=YES
EXECUTABLES_FOLDER_PATH=cocospadtest.app/Executables
LOCAL_APPS_DIR=/Applications
ENABLE_STRICT_OBJC_MSGSEND=YES
REMOVE_CVS_FROM_RESOURCES=YES
SED=/usr/bin/sed
SYSTEM_DEVELOPER_UTILITIES_DIR=/Applications/Xcode6.x.app/Contents/Developer/Applications/Utilities
@KAMEDAkyosuke
KAMEDAkyosuke / response.json
Last active May 18, 2018 13:27
複数画像が含まれた tweet を https://api.twitter.com/1.1/statuses/show.json で取得した際のレスポンス
{"created_at":"Sun Feb 22 00:27:31 +0000 2015","id":569292363937349633,"id_str":"569292363937349633","text":"#\u6771\u4eac\u30de\u30e9\u30bd\u30f3 \u304c\u30b9\u30bf\u30fc\u30c8\uff01\n@Tokyo42195_org \u304b\u3089\u5927\u4f1a\u306e\u69d8\u5b50\u304c\u30c4\u30a4\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\nRT @tokyo42195_org: \u8eca\u3044\u3059\u306b\u7d9a\u304d\u3001\u30de\u30e9\u30bd\u30f3\u30fb10km\u3082\u30b9\u30bf\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002\u30d5\u30b8\u30c6\u30ec\u30d3\u7cfb\u5168\u56fd\u30cd\u30c3\u30c8\u3067\u653e\u9001\u4e2d\u3067\u3059\u3002 http:\/\/t.co\/LoEKszyJ2e","source":"\u003ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003eTweetDeck\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1159274324,"id_str":"1159274324","name":"Twitter Sports Japan","screen_name":"TwitterSportsJP","location":"To
package main
import "log"
import "reflect"
func Apply(f interface{}, args []interface{}) interface{}{
fv := reflect.ValueOf(f)
if fv.Kind() != reflect.Func {
log.Fatal("error")
}
@KAMEDAkyosuke
KAMEDAkyosuke / find-grep NS_AVAILABLE_IOS(10_3.sh
Last active March 29, 2017 03:08
find . -type f -exec grep -B 10 -nH -e ios\(10.3 {} +
$ find . -type f -exec grep -B 10 -nH -e NS_AVAILABLE_IOS\(10_3 {} +
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-577-AVF_EXPORT NSString *const AVAudioSessionInterruptionOptionKey NS_AVAILABLE_IOS(6_0);
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-578-
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-579- /* Only present in begin interruption events, where the interruption is a direct result of the application being suspended
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-580- by the operating sytem. Value is a boolean NSNumber, where a true value indicates that the interruption is the result
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-581- of the application being suspended, rather than being interrupted by another audio session.
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-582-
./AVFoundation.framework/