Skip to content

Instantly share code, notes, and snippets.

View vestige's full-sized avatar

Makoto Yonezawa vestige

View GitHub Profile
var myobj;
(function() {
var name = "my, oh, oh";
myobj = {
getName: function() {
return name;
}
};
}());
var myarray;
(function() {
var astr = "[object Array]",
toString = Object.prototype.toString;
function isArray(a){
return toString.call(a) === astr;
}
# http://icpc2010.honiden.nii.ac.jp/domestic-contest/problems#section_A
# 1
# 5
# 0 0
# 0 1
# 0 2
# 0 3
class Kaku
@vestige
vestige / gist:3938681
Created October 23, 2012 13:18
541.js
MYAPP.utilities.array = (function () {
var array_string = "[object Array]",
ops = Object.prototype.toString,
inArray = function (haystack, needle) {
for (var i = 0, max = haystack.length; i < max; i += 1) {
if (haystack[i] === needle) {
return i;
}
}
class Maze
def initialize(w,h,input)
@len_map = Hash.new
@len_map[[w-1,h-1]] = 1
make_fence(input)
end
def make_fence(input)
lr, tb = [], []
input.each_with_index do |e,i|
@vestige
vestige / gist:4139197
Created November 24, 2012 11:04
seed.rb
# -*- encoding: UTF-8 -*-
names = [ "切手を買う", "報告書を書く", "家賃を払う", "猫の餌を買う", "燃えないゴミを出す"
]
description = "これは説明です。" * 20
5.times do |n|
Task.create(:name => names[n], :description => description,
:due_date => (n - 2).days.from_now, :done => n.zero?)
end
200.times do |n|
@vestige
vestige / gist:4154168
Created November 27, 2012 13:11
561.js
document.writeln("\nspike");
document.writeln("2012.11.27");
var Gadget = function () {};
Gadget.isShiny = function () {
return "you bet";
};
Gadget.prototype.setPrice = function(price) {
@vestige
vestige / gist:4154276
Created November 27, 2012 13:42
562.js
var Gadget = (function() {
var counter = 0,
NewGadget;
NewGadget = function () {
counter += 1;
};
NewGadget.prototype.getLastId = function () {
@vestige
vestige / gist:4258649
Created December 11, 2012 13:42
mchain.js
var obj = {
value: 1,
increment: function () {
this.value += 1;
return this;
},
add: function (v) {
this.value += v;
return this;
@vestige
vestige / 59.js
Last active December 10, 2015 03:18
if (typeof Function.prototype.method !== "function") {
Function.prototype.method = function (name, implementation) {
this.prototype[name] = implementation;
return this;
};
}
var Person = function (name){
this.name = name;
}.