Skip to content

Instantly share code, notes, and snippets.

@kysnm
kysnm / google_apps_script
Created June 17, 2011 15:22
GoogleAnalyticsAPI for Google Spreadsheet
var DateTime = function() {
var now = new Date();
this.year = now.getFullYear();
this.month = ('00' + now.getMonth()).slice(-2);
var monthEndDate = new Date(this.year, this.month, 0);
this.startDate = this.year + '-' + this.month + '-01';
this.endDate = this.year + '-' + this.month + '-' + monthEndDate.getDate();
}
var Profile = function(profileName, tableId) {
@kysnm
kysnm / gist:1307226
Created October 23, 2011 10:38
AnyEvent::HTTP で 200 以外が帰ってきた時にリトライする
use AnyEvent;
use AnyEvent::HTTP;
my $w;
my $cv = AE::cv;
my @urls = qw{
http://localhost:5000/
http://localhost:5001/
};
my @watchers;
@kysnm
kysnm / 1_50.rb
Created February 12, 2012 12:48
離散数学読書会(@2012-02-12)
def myset(a1, a2)
h = Hash.new(0)
a1.each{|a| h[a] += 1}
a2.each{|a| h[a] += 1}
puts "a and b"
p h.select{|k, v| v == 2}.keys
puts "a or b"
p h.keys
player.intersectScale = function(other) {
return this.x < other.x + (other.width * other.scaleX) &&
other.x < this.x + (this.width * this.scaleX) &&
this.y < other.y + (other.height * other.scaleY) &&
other.y < this.y + (this.height * this.scaleY);
};
@kysnm
kysnm / install.sh
Created May 28, 2012 03:29
rvm install 1.9.3 on Ubuntu 10.04
wget -q -O - https://raw.github.com/gist/2817051/e3e5f4d268994ae4d103329f845b34cb6a54b8df/install_rvm_1.9.3_on_Ubuntu_10.04.sh | bash
@kysnm
kysnm / install.sh
Created May 28, 2012 03:42 — forked from cloud8421/install.sh
Install tmux 1.6 on Ubuntu 10.04 with checkinstall
wget -q -O - https://raw.github.com/gist/2204072/4fe9d4a62921865005ab19ee4f90c67f27ec58cb/install_tmux_1.6_on_ubuntu_10.04.sh | sudo bash
@kysnm
kysnm / file0.txt
Created November 29, 2012 14:36
Play2.0 / Scala で動的に設定値を追加 ref: http://qiita.com/items/d3ad5dbc60e857397256
play console [info] Loading project definition from /private/tmp/todolist/project
[info] Set current project to todolist (in build file:/private/tmp/todolist/)
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_35).
Type in expressions to have them evaluated.
Type :help for more information.
scala> new play.core.StaticApplication(new java.io.File("."))
[info] play - database [default] connected at jdbc:postgresql://localhost:5432/todolist
@kysnm
kysnm / file0.txt
Created November 29, 2012 14:37
Play 2.0 / Scala の WS で同期リクエスト ref: http://qiita.com/items/bcb41ebfb5818a5a0305
package models
import play.api.libs.ws.WS.WSRequestHolder
import play.api.libs.ws.WS.url
import play.api.libs.concurrent.Promise
import play.api.libs.ws.Response
object Qiita {
def getTags = {
val wsRequestHolder: WSRequestHolder = url("https://qiita.com/api/v1/tags")
@kysnm
kysnm / hello.js
Created December 3, 2012 06:51 — forked from shigeki/hello.js
第1回Node.js入門勉強会 レポート課題
var http = require('http');
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
server.close();
});
server.listen(8080, 0, function () {
console.log('Server running at http://localhost:8080/');
});
% heroku run bash
Running `bash` attached to terminal... up, run.4287
~ $ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"
~ $