Skip to content

Instantly share code, notes, and snippets.

View ya-s-u's full-sized avatar
🍺
Drinking

Yasuaki Goto ya-s-u

🍺
Drinking
View GitHub Profile
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@agnellvj
agnellvj / friendly_urls.markdown
Created September 11, 2011 15:52 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@kkosuge
kkosuge / 最近のタイムライン保存事情.md
Created November 19, 2011 14:46
最近のタイムライン保存事情

最近のタイムライン保存事情

TwitterのタイムラインはJSONで流れてくるので、JSONぽい形式でデータを突っ込むMongoDBと相性が良い。
今まではtimeline.logとして書き出してたけど、GB単位に膨らんだテキストファイル重すぎて扱いづらいし最近は専らMongoDBに流し込んでます。
全部保存しとくと、誰がいつどのtweetを消したとか分かって異常に便利。こわい。
全文検索したいときがあるので、ツイイトはわかち書きでsplitして配列としても入れといてます。
MongoDBは配列で保存出来て、配列内にインデックスを貼れるので、簡単にいい感じの検索機能が作れて楽しいですね。
TLの全保存やってる人自体はそこら中に居るだろうし目新しいことは特にないでした。

@sauloarruda
sauloarruda / receipt
Created April 30, 2012 15:47
Apple iOS in app purchase validate receipt in Ruby
ewoJInNpZ25hdHVyZSIgPSAiQXBNVUJDODZBbHpOaWtWNVl0clpBTWlKUWJLOEVk
ZVhrNjNrV0JBWHpsQzhkWEd1anE0N1puSVlLb0ZFMW9OL0ZTOGNYbEZmcDlZWHQ5
aU1CZEwyNTBsUlJtaU5HYnloaXRyeVlWQVFvcmkzMlc5YVIwVDhML2FZVkJkZlcr
T3kvUXlQWkVtb05LeGhudDJXTlNVRG9VaFo4Wis0cFA3MHBlNWtVUWxiZElWaEFB
QURWekNDQTFNd2dnSTdvQU1DQVFJQ0NHVVVrVTNaV0FTMU1BMEdDU3FHU0liM0RR
RUJCUVVBTUg4eEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUtEQXBCY0hCc1pT
QkpibU11TVNZd0pBWURWUVFMREIxQmNIQnNaU0JEWlhKMGFXWnBZMkYwYVc5dUlF
RjFkR2h2Y21sMGVURXpNREVHQTFVRUF3d3FRWEJ3YkdVZ2FWUjFibVZ6SUZOMGIz
SmxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1CNFhEVEE1TURZeE5U
SXlNRFUxTmxvWERURTBNRFl4TkRJeU1EVTFObG93WkRFak1DRUdBMVVFQXd3YVVI
@inonb
inonb / gist:3157988
Created July 22, 2012 02:31
[iOS] JSONをパースして配列を取得・テーブルビューに表示
- (void)viewDidLoad
{
[super viewDidLoad];
// 空の配列を用意
self.items = [NSArray array];
[self getJSON];
}
@FaviusTy
FaviusTy / n_ostruct.rb
Last active October 8, 2015 04:58
単品で動くテストコードを追加
#encoding: utf-8
require 'ostruct'
# OpenStructを拡張
# Value以下ネストされたHashも全てOpenStructインスタンスとして展開します
class NestedOpenStruct < OpenStruct
def initialize(hash=nil)
@table = {}
@wokamoto
wokamoto / just.php
Last active October 9, 2015 05:28
特定のプラグインを有効にするプラグイン
<?php
/*
Plugin Name: Just do it !
Plugin URI:
Description:
Version: 0.1
Author:
Author URI:
*/
new just_do_it();
@brianflurry
brianflurry / service_hello_tests.js
Created October 2, 2012 17:47
Hello World Mocha regression test
// init the test client
var client = restify.createJsonClient({
version: '*',
url: 'http://127.0.0.1:8080'
});
describe('service: hello', function() {
// Test #1
describe('200 response check', function() {
@2no
2no / exsample.js
Created November 24, 2012 12:42
jQuery.timeline.js - アニメーションタイムライン
// jQuery、timeline.js を事前に読み込んでおく必要あり
//
// timeline.js について
// - http://hitsujiwool.tumblr.com/post/31191259501/timeline-js
// - https://github.com/hitsujiwool/timeline
// 使い方1:一括指定して実行
var totalFrames = 200,
tl = $("div").timeline(totalFrames)
@asanoboy
asanoboy / staging.py
Created December 3, 2012 12:21
Django Middleware to protect by HTTP Basic Authorization for staging.
from django.http import HttpResponse
from django.conf import settings
import base64
ID = settings.STAGING_HTTP_BASIC_AUTH_ID or False
PW = settings.STAGING_HTTP_BASIC_AUTH_PW or False
class AuthMiddleware(object):
def process_request(self, request):