Skip to content

Instantly share code, notes, and snippets.

View geta6's full-sized avatar

geta6 geta6

View GitHub Profile
@geta6
geta6 / Gemfile
Created June 25, 2012 12:26
PhoneGap用のコードをcoffee, less, hamlで書く
source 'http://rubygems.org'
gem 'guard'
gem 'guard-less'
gem 'guard-haml'
gem 'guard-coffeescript'
gem 'rb-fsevent'
gem 'growl'
@geta6
geta6 / queries.coffee
Created July 8, 2012 16:28
mongooseでschemaをネストする
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
# スキーマ定義
PostSchema = new Schema
title: type: String, unique: true
content: String
author: type: ObjectId, ref: 'users'
comments: [ type: ObjectId, ref: 'comments' ]
created: type: Date, default: new Date.now()
@geta6
geta6 / nginx.conf
Created July 8, 2012 17:40
nginxで静的コンテンツとphpとnodejsのリクエストをうまいことさばく
upstream proxy {
server localhost:3000;
}
server {
listen 80 default_server;
server_name _;
return 404;
}
@geta6
geta6 / phoneguardinit.sh
Created July 12, 2012 04:08
phoneguardをinitします
#!/bin/sh
# create PhoneGapTemplate in /path/to/PHONEGAP_PROJECT_ROOT from Xcode.app
# cd /path/to/PHONEGAP_PROJECT_ROOT
git clone https://github.com/geta6/phoneguard
mv phoneguard/G* assets www .
yes|rm -r phoneguard
cp ~/../Shared/Cordova/Frameworks/Cordova.framework/www/cordova* ./www/js/
@geta6
geta6 / shairport_install.sh
Created July 12, 2012 05:06
install shairport
#!/bin/sh
export ARCHFLAGS="-arch x86_64"
# Get source
mkdir -p /usr/local/share
cd /usr/local/share
git clone https://github.com/albertz/shairport
# Dependencies
@geta6
geta6 / index.html
Created August 23, 2012 03:35
access to :before or :after objects using javascript
<html>
<head>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<div id='target'></div>
<input id='button' type='button' value='click'>
<script src='script.js'></script>
</body>
</html>
@geta6
geta6 / index.html
Created August 23, 2012 04:16
maximise `input` element according as parent element.
<html>
<head>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<div id='parent'>
<input id='input' type='text'>
</div>
</body>
</html>
@geta6
geta6 / sudden
Created August 29, 2012 09:12
突然のsudden
#!/usr/bin/env coffee
String.prototype.repeat = (n) ->
b = ''
b += @ for num in [1..n]
return b
util =
jplen: (text) ->
@geta6
geta6 / partial.coffee
Created September 27, 2012 10:13
response partial content in node.js
#
# blob : Object from MongoDB
#
# blob.body: Buffer
# blob.size: length of buffer, substitute for blob.body.length
# blob.type: MIME (Eg. audio/x-wav)
#
# req : Object from http
# res : Object from http
# _ : Object from underscore
@geta6
geta6 / fb.js
Created October 1, 2012 04:21
FizzBuzz
for(i=0;i++<100;)console.log(i%15?i%5?i%3?i:'Fizz':'Buzz':'FizzBuzz')