Skip to content

Instantly share code, notes, and snippets.

View hyrious's full-sized avatar
💤
lazy

hyrious hyrious

💤
lazy
View GitHub Profile
@scheakur
scheakur / detectarray.js
Created September 9, 2011 16:43
Check performance of detecting arrays in Rhino
// Original is http://d.hatena.ne.jp/uupaa/20090116/1232051707
var array = [];
var notarray = {};
(function () {
var S = new Date*1;
var toString = Object.prototype.toString;
for (var i = 0; i < 5000000; i++) { ( toString.call(array) === "[object Array]" ) }
print('Array#Object.prototype.toString.call : ' + (new Date-S));
}());
@orzFly
orzFly / rgssruntime.rb
Last active May 11, 2019 09:45
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
=begin
RGSSRuntime Module 1.0 for RPG Maker XP/VX/VX Ace
http://orzFly.com/html/rgssruntime.html
Copyright 2013-2014 Yeechan Lu a.k.a. orzFly <i@orzFly.com>
Partial Copyright 2013-2014 Seiran A. [http://seiran.mist.so/]
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@westc
westc / limitEval.js
Created March 16, 2016 22:08
Use web workers to limit the amount of time that an eval can run.
function limitEval(code, fnOnStop, opt_timeoutInMS) {
var id = Math.random() + 1,
blob = new Blob(
['onmessage=function(a){a=a.data;postMessage({i:a.i+1});postMessage({r:eval.call(this,a.c),i:a.i})};'],
{ type:'text/javascript' }
),
myWorker = new Worker(URL.createObjectURL(blob));
function onDone() {
URL.revokeObjectURL(blob);
@Youka
Youka / fiddle_test.rb
Created December 30, 2014 13:21
Simple use of ruby's fiddle library for windows messageboxes
# Load importer part of fiddle (ffi) library
require 'fiddle/import'
# Create module as body for an importer instance
module MessageBox
# Extend this module to an importer
extend Fiddle::Importer
# Load 'user32' dynamic library into this importer
dlload 'user32'
# Set C aliases to this importer for further understanding of function signatures