Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
georgeOsdDev / gist:8645737
Created January 27, 2014 09:40
fake navigator for phantomjs
var fakeNavigator = {};
for (var i in navigator) {
fakeNavigator[i] = navigator[i];
}
fakeNavigator.onLine = true;
navigator = fakeNavigator;
@georgeOsdDev
georgeOsdDev / gist:8781303
Created February 3, 2014 10:05
console.log with linenumber and application prefix
function MyApplication(name, opt){
var self = this;
this.name = name;
this.option = (function(){
var defaultOpt = {
"loglevel": "verbose"
};
for (var k in defaultOpt){
if (opt && opt.hasOwnProperty(k)) defaultOpt[k] = opt[k];
}
@georgeOsdDev
georgeOsdDev / eventEmitter.js
Created February 13, 2014 03:22
Tiny EventEmitter for browser.
/**
* Tiny EventEmitter for browser.
* Copyright [Takeharu.Oshida](http://georgeosddev.github.com)
* Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
*/
(function(global){
var alice = Array.prototype.slice;
function EventEmitter(){
this.dom = window.document.createDocumentFragment();
}
@georgeOsdDev
georgeOsdDev / gist:9387518
Created March 6, 2014 11:13
Reference "com.sun.nio.file.SensitivityWatchEventModifier" in the case of oracleJDK
private def get_com_sun_nio_file_SensitivityWatchEventModifier_HIGH: Option[Modifier] = {
try {
val c = Class.forName("com.sun.nio.file.SensitivityWatchEventModifier")
val f = c.getField("HIGH")
val e = f.get(c).asInstanceOf[Modifier]
Some(e)
} catch {
case NonFatal(e) =>
None
}
@georgeOsdDev
georgeOsdDev / gist:9501747
Created March 12, 2014 06:08
Disable javascript execution from console
// Disable javascript execution from console
// http://kspace.in/blog/2013/02/22/disable-javascript-execution-from-console/
var _z = console;
Object.defineProperty( window, "console", {
get : function(){
if( _z._commandLineAPI ){
throw "Sorry, Can't exceute scripts!";
}
return _z;
},
@georgeOsdDev
georgeOsdDev / expand.js
Created March 12, 2014 10:03
Bookmarklet for expand <pre> on github
javascript:$(".highlight").css({"width":"1000px","z-index":"1000px"});$(".highlight pre").css({"overflow":"visible"});$("pre").css({"overflow":"visible","width":"1000px","z-index":"1000px"});
@georgeOsdDev
georgeOsdDev / gist:9662196
Created March 20, 2014 11:58
マスターブランチに追従して作業ブランチの細かいコミットを一つにする。
git commit -m "temp commit log"
git checkout master
git pull
git merge --squash workbranch
git commit -m "commit log for master"
#or
git commit -m "temp commit log"
git checkout master
@georgeOsdDev
georgeOsdDev / gist:9910563
Created April 1, 2014 09:04
Remove color control character
cat log/xxx.log | col -bx | sed -e 's/[0-9]\{1,\}m//g' > log/xxx_pretty.log
@georgeOsdDev
georgeOsdDev / websocket.xml
Created April 1, 2014 09:08
Tsung config file for websocket benchmark
<?xml version="1.0"?>
<!-- Path should be correct -->
<!DOCTYPE tsung SYSTEM "/home/ec2-user/opt/tsung-latest/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<!-- Clients to generate load -->
<clients>
<!-- Must be hostname, can't be IP -->
<client host="tsung1" >
<ip scan="true" value="eth0"/>
</client>
@georgeOsdDev
georgeOsdDev / websocket.xml
Last active August 26, 2019 13:26
Tsungによるwebsocket負荷テスト(日本語説明付き)
<!--
http://george-osd-blog.heroku.com/25
http://george-osd-blog.heroku.com/26
-->
<?xml version="1.0"?>
<!-- インストールしたTsungのPathとあっていること -->
<!DOCTYPE tsung SYSTEM "/home/ec2-user/opt/tsung-latest/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">