Skip to content

Instantly share code, notes, and snippets.

View oogatta's full-sized avatar

Naohiro Oogata oogatta

View GitHub Profile
.PHONY: test
test:
@find test/test-*.js | xargs -n 1 -t node
// ==UserScript==
// @name Toggle Google results page language
// @namespace http://bitmap.dyndns.org/
// @description Japanese <-> English
// @include http://*.google.*/search?*
// ==/UserScript==
(function() {
window.__toggleGoogleLinkClickFlag = false;
document.addEventListener('mousedown', function(e) {
window.__toggleGoogleLinkClickFlag = ( e.target.tagName == 'A' );
.gwt-HTML {
font-size:11px!important;
}
textarea.postBarTextarea {
background:#eee!important;
color:#333!important;
}
var a = 'global';
Object.prototype.b = 'Object';
function test1() {
console.log(a);
console.log(b);
}
function test2() {
var b = 'inner';
@oogatta
oogatta / fundef.dart
Created October 11, 2011 00:20
[Dart] kinds of function definition
// ノーマルな形
// ※ところで今の仕様書に FunctionDeclaration っていう Production が無いのはなぜ?
int func(int a) {
return a;
}
// FunctionExpression を使う場合。
// Dart に Function Type はあるけど (T) -> <T> っていうよくわからん型なので、
// FunctionTypeAlias (エイリアス)を定義する。らしい。
typedef int A(int a);
@oogatta
oogatta / gist:3149996
Created July 20, 2012 10:12
perl hash slice
#!/usr/bin/perl
use strict;
use warnings;
my %testhash = (
test => 1,
hoge => 2,
fuga => 3,
);
// ...
concat: {
core: {
src: ['src/brook.js','src/brook/util.js','src/brook/lambda.js','src/brook/channel.js','src/brook/model.js'],
dest: 'build/brook-core.js'
},
htp: {
src: ['<file_enclose_with_namespace:brook.view.htmltemplate.core:lib/html-template-core.js>'],
dest: 'build/brook-view-htmltemplate-core.js'
},
@oogatta
oogatta / gist:3552351
Created August 31, 2012 12:56
anti ie zombie tab
window.onbeforeunload = function() {
document.body.innerHTML = '';
};
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="document.getElementById('test').innerHTML='JS time:'+(new Date()).toString();">
<?php
echo "PHP time:" . date("Y/m/d g:i:s");
?>
<p id="test"></p>
<?php
header("Cache-Control:no-cache");
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="document.getElementById('test').innerHTML='JS time:'+(new Date()).toString();" onunload="">
<?php
echo "PHP time:" . date("Y/m/d g:i:s");