- Create a project in XCode with the default settings
- iOS > Application > Single View Application
- Language: Swift
- Under project General settings, add ReactKit to Linked Framework and Libraries
- + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
- Now ReactKit would have been imported. Link it by choosing it from the list.
- + > lib.ReactKit.a
- Under project Build Settings,
We need to patch Go's source code to allow cgo when cross-compiling and make Android-specific changes since it sometimes differs from linux (e.g.: it doesn't use /etc/resolv.conf for DNS config)
- Clone the go source:
hg clone -u release https://code.google.com/p/go
- Enter the go source directory:
cd go
- Apply the patch in this gist:
patch -p1 < /path/to/patch/go_android.patch
- Enter the go/src directory:
cd src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '#!/bin/bash' | |
echo '' | |
echo 'failed_items=""' | |
echo 'function install_package() {' | |
echo 'echo EXECUTING: brew install $1 $2' | |
echo 'brew install $1 $2' | |
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.' | |
echo '}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var attempts = 1; | |
function createWebSocket () { | |
var connection = new WebSocket(); | |
connection.onopen = function () { | |
// reset the tries back to 1 since we have a new connection opened. | |
attempts = 1; | |
// ...Your app's logic... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Refer to https://gist.github.com/remy/350433 | |
try { | |
// Test webstorage existence. | |
if (!window.localStorage || !window.sessionStorage) throw "exception"; | |
// Test webstorage accessibility - Needed for Safari private browsing. | |
localStorage.setItem('storage_test', 1); | |
localStorage.removeItem('storage_test'); | |
} catch(e) { | |
(function () { | |
var Storage = function (type) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DOUBLE_PRESS_DELAY = 300; | |
// ... | |
/** | |
* Double Press recognition | |
* @param {Event} e | |
*/ | |
handleImagePress(e) { | |
const now = new Date().getTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
私が使っているCWMと通常起動を分岐させるスクリプトです。 | |
起動時に音量キーを連打するとCWM起動になります。 | |
bootイメージを展開して/initを/init.origにリネームし、代わりにこのスクリプトを/initに配置します。 | |
busybox環境を/binに配置します。 | |
CWM起動用のramdiskをtarで固めて/bin/recovery.tar.gzに配置します。 | |
また、/bin/_suを配置しておくと良いと思います。 | |
SH-04EとSH-06Eはexecでinit.origを実行すると何故か電波を掴まないので、CWMを起動しない場合はreboot recoveryします。 | |
この機種は通常起動のブートイメージをrecoveryに焼いて下さい。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# swith to sudo | |
sudo -i | |
# create swap | |
touch /2GiB.swap | |
chattr +C /2GiB.swap | |
fallocate -l 2048m /2GiB.swap | |
chmod 600 /2GiB.swap | |
mkswap /2GiB.swap |
Re: http://twitter.com/hondallica/status/436117998823165952
クソコードを見たとき: "Looking at this code is pure agony!"
同僚がバグを直してくれた時: "You are an angel sent to save me!"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
過去にCWM対応させた物はビルド用のデバイス定義を android_device_sharp_xxx というリポジトリで置いてあります。 | |
多分参考になると思います。 | |
recovery/root/init.recovery.qcom.rcが肝で、ここに機種依存の設定を書きます。 | |
これを仕上げるのが結構大変です。 | |
adbやCWMの動作に必要な、/systemにあるサービスのバイナリと使用するライブラリはproprietary-files.txtに書いてextract-files.shを実行してツリーに取り込みます。 | |
これらのファイルはramdiskの/vendor配下に展開されます。 | |
そのままでは/vendorに置いても動作しないので、extract-files.shは取り込みを行う際に/vendorで動く様にパッチします。 | |
また、/vendor/binに実行権限が付与されないのでadd_permission_for_vendor.patchを適用する必要があります。 |