This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Hoge | |
{ | |
static function foo() | |
{ | |
return function() { | |
echo "test"; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Hoge(name) { | |
this.name = name; | |
} | |
Hoge.prototype.greet = function() { | |
return 'Hello, ' + this.name; | |
}; | |
Hoge.prototype.toJSON = function() { | |
var key, ret = { __meta__ : {} }; | |
for (key in this) { | |
switch (typeof(this[key])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Blob</title> | |
</head> | |
<body> | |
<input type="file" id="file-field"> | |
<img id="preview" src="" alt=""> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define([ | |
'underscore', | |
'backbone' | |
], function(_, Backbone) { | |
factory(root, _, Backbone); | |
}); | |
} else if (typeof exports !== 'undefined') { | |
var _ = require('underscore'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.toUTCJSON = Date.prototype.toJSON; | |
Date.prototype.toJSON = function() { | |
var sep = this.toString().match(/\w{3}\s\w{3}\s(\d{2})\s(\d{4})\s(\d{2}:\d{2}:\d{2})\sGMT(\+\d{4})/); | |
return sep[2] + '-' + ('0' + this.getMonth()).slice(-2) + '-' + sep[1] + 'T' + sep[3] + sep[4]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ChatWork Image Extractor | |
// @description Image extractor for ChatWork. | |
// @include https://www.chatwork.com/* | |
// @version 0.0.1 | |
// ==/UserScript== | |
(function() { | |
var forEach = Array.prototype.forEach, | |
ATTR_NAME_APPEND_IMG_DONE = 'data-append-img-done', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('class', function() { | |
var clazz = require('../src/class').clazz, | |
User = clazz('User', { | |
id : Number, | |
name : String, | |
birthday : Date, | |
owner : Boolean, | |
greet : function() { | |
return 'Hello ' + this.name(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var worker = new Worker('worker.js'); | |
worker.addEventListener('message', function(evt) { | |
var meta = evt.data, | |
key; | |
for (key in meta) { | |
console.log(key + ':' + meta[key]); | |
} | |
}, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Observable(o) { | |
o._$eObj = $({}); | |
var key, | |
fn; | |
for (key in o) { | |
fn = o[key]; | |
if (typeof(fn) === 'function') { | |
o[key] = (function(_fn) { | |
return function() { | |
var ret = _fn.apply(o, arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function() { | |
'use strict'; | |
// Model ***************************************************** | |
var icecreamModel = { | |
list : [ | |
{ id : 't1', name : 'バニラ' }, | |
{ id : 't2', name : 'チョコレートチップ' }, | |
{ id : 't3', name : 'オレンジシャーベット' }, |
NewerOlder