Skip to content

Instantly share code, notes, and snippets.

View zaru's full-sized avatar
😍
write code

zaru zaru

😍
write code
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@yagitoshiro
yagitoshiro / push_notifications.js
Last active August 13, 2016 17:29
apple push notification sample (Titanium Mobile)
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
@billdawson
billdawson / android_scons_speedups.md
Created January 11, 2012 21:41
Speeding up Titanium Build

Speeding up Titanium Mobile Build

(The command examples assume OS X).

Just about everything that happens when you enter scons is for Android. So anything you can do to speed up the Android part of our build will be useful.

  • Android NDK r7 can use ccache. We get huge improvements in build time with it. So install it (if you have HomeBrew, brew install ccache) then set a shell variable NDK_CCACHE to point to it. I.e., for me, having installed it with brew, it would be export NDK_CCACHE=/usr/local/bin/ccache.

  • NDK can also parallelize while compiling. Set a shell variable NUM_CPUS to (according to Opie) 2x the number of cores in your machine. A quick way to get the # cores on your machine in OS X is system_profiler | grep "Number Of Cores" in terminal. I have 2 cores, so my shell var setting is export NUM_CPUS=4.

@ssig33
ssig33 / yosou.rb
Created June 25, 2012 08:16
ファーストサーバーの事故についてちょっと具体的に想像してみました
# ホットスタンバイがバックアップじゃないとかその手の話はとりあえず置いておきます
#
# なぜこんな間抜けな事故が起きたかについてだけ想像
#
# 1. いろんなサーバーメンテナンスをスクリプトでやっていた
# 2. スクトプトは随時使い回したり書き換えたりして使っていた
#
# という状態であったと推測する。中小規模自社サービスとかやってるところとかもわり
# とこうなんじゃないですかね。ホスティングでそのレベルでいい加減なのどうなんでし
# ょうか。
@KOBA789
KOBA789 / this.js
Created July 2, 2012 14:50
あなたがJavaScriptを嫌いになるのに十分なコード
function Class (bar) {
this.foo = bar;
}
Class.prototype.method = function () {
return this.foo;
};
var instance = new Class('baz'),
func = instance.method;
@yagitoshiro
yagitoshiro / gist:3039968
Last active October 19, 2015 05:50
Titanium Mobile用のSQLiteを扱うクラス・第二形態 update: 更新も保存もsaveに統一
# モデルがこれだけで作れたら素敵じゃないか
# entry.coffee
Database = require('libs/database')
class Entry extends Database
initialize:()->
@property 'title', 'text'
@property 'body', 'text'
super
module.exports = new Entry('entries')
@mala
mala / gist:3128358
Created July 17, 2012 09:40
利用者の使っているフィルタリングソフトの基準に合わせて表示される広告にゾーニングを適用する法、及びその問題点について
https://twitter.com/bulkneets/status/224725678833147904
ってのを書いたわけだけど
元ネタは覚えてる人居ないかもしれないけど、ココらへんの話ねー
http://internet.watch.impress.co.jp/docs/news/20090728_305316.html
http://mixi.co.jp/press/2009/0727/1691/
で、後々、携帯電話会社とちゃんと連携して、契約者の年齢わかるようにした。
http://mixi.co.jp/press/2011/0119/4179/
@inonb
inonb / gist:3157988
Created July 22, 2012 02:31
[iOS] JSONをパースして配列を取得・テーブルビューに表示
- (void)viewDidLoad
{
[super viewDidLoad];
// 空の配列を用意
self.items = [NSArray array];
[self getJSON];
}
@voluntas
voluntas / gist:73efe2f36ac1513c02a8
Created August 5, 2012 16:13
レビューのススメ?

レビューのススメ?

typo 死ぬほど多いので突っ込みまってます

バージョン:0.2.3
作者:@voluntas

考え方はコロコロ変わるタイプなのですが、最近はレビューが実はとても大事でとにもかくにもレビューなのでは?と思い始めてきています。

fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {