Skip to content

Instantly share code, notes, and snippets.

@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 / 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 .
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 / 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//)
@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 / 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