Skip to content

Instantly share code, notes, and snippets.

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 / 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
@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 / 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) {