Skip to content

Instantly share code, notes, and snippets.

View MultiCoinCharts's full-sized avatar

MultiCoinCharts (Pre-public) MultiCoinCharts

View GitHub Profile
@jeffrafter
jeffrafter / Crazy IE getter setter proxy hack.html
Created September 18, 2009 23:34
Crazy IE getter setter proxy hack
<!-- modified from http://alex.dojotoolkit.org/08/jscript/lettable.html -->
<html>
<head>
<title>A Crazy Getter/Setter Hack</title>
</head>
<body>
<script language="VBScript" type="text/VBScript">
Function exec_vb_global(code)
ExecuteGlobal(code)
End Function
@ynkdir
ynkdir / zip.js
Created February 4, 2011 11:33
zip.js
// WSH
function zip(zipfile, files) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("Shell.Application");
var process_id = get_process_id();
// create empty zip (right click -> new file -> compressed (zipped) folder)
var zip = fso.CreateTextFile(zipfile, true);
@WebReflection
WebReflection / Function.prototype.notifier.js
Created November 7, 2011 18:08
A Function.prototype method handy to monitor "functions lifecycle"
Function.prototype.notifier = (function () {"use strict";
// (C) WebReflection - Mit Style License
function create(callback) {
function notifier() {
var args = [].slice.call(arguments), output;
if (fire(notifier, "before", callback, this, args, null)) {
try {
output = callback.apply(this, args);
} catch(e) {
fire(notifier, "error", callback, this, args, e);
@WebReflection
WebReflection / ienewfeatures_usethem.js
Created November 29, 2011 20:11
Some thoughts on MS code used "to impress" with modern demos ...
// I know it's for demo purpose from MS:
// http://ie.microsoft.com/testdrive/HTML5/TypedArrays/js/binaryReader.js
BinaryReader.prototype = {
readUint8: function () { var result = this.dataView.getUint8(this.streamPosition, true); this._movePointerTo(this.streamPosition + 1); return result; },
readInt8: function () { var result = this.dataView.getInt8(this.streamPosition, true); this._movePointerTo(this.streamPosition + 1); return result; },
readUint16: function () { var result = this.dataView.getUint16(this.streamPosition, true); this._movePointerTo(this.streamPosition + 2); return result; },
readInt16: function () { var result = this.dataView.getInt16(this.streamPosition, true); this._movePointerTo(this.streamPosition + 2); return result; },
readUint32: function () { var result = this.dataView.getUint32(this.streamPosition, true); this._movePointerTo(this.streamPosition + 4); return result; },
readInt32: function () { var result = this.dataView.getInt32(this.s
@aya-eiya
aya-eiya / MD5cmd.js
Created March 6, 2012 14:41
便利コマンドバッチ集(ファイルサイズ取得/MD5取得/JScript正規表現置換/etc..)
// MD5cmd.js
// (C) aya_eiya 2012
(function (){
function readBinaryFile(FileName){
var streamObj = new ActiveXObject("ADODB.Stream");
var resultObj = null;
streamObj.Type = 1;
streamObj.Open();
streamObj.LoadFromFile(FileName);
@squaremo
squaremo / constructor_inheritance.js
Last active July 24, 2021 06:23
Snippets for PMD post
function Bloop() { }
var bloop = new Bloop();
bloop.constructor === Bloop; // and indeed,
bloop.constructor === Bloop.prototype.constructor;
@kavun
kavun / WSHRepl.js
Last active April 1, 2021 04:45
JScript in/out console for Windows Script Host
function print(text) {
WScript.Echo('> ' + text);
}
var stdin = WScript.StdIn;
var stdout = WScript.StdOut;
var input;
do {
var input = stdin.ReadLine();
@duncansmart
duncansmart / httpget.js
Created June 20, 2013 09:42
Download a file with Windows Script Host
// httpget.js: download a file (Windows Script Host)
// usage: cscript httpget.js <url> <file>
(function() {
if (WScript.Arguments.Length != 2) {
WScript.Echo("Usage: httpget.js <url> <file>")
WScript.Quit(1)
}
var url = WScript.Arguments(0)
@bennadel
bennadel / code-1.htm
Created March 25, 2014 12:09
Using JavaScript's With Keyword To Create A Dynamic Scope Chain For Method Execution
<!DOCTYPE html>
<html>
<head>
<title>Creating A Dynamic Scope Chain For Method Execution</title>
<script type="text/javascript">
// I return a function with a "scope" property that can be
// used to alter the runtime bindings of the functions.
var getFoo = (function(){
@WebReflection
WebReflection / state.js
Created May 13, 2016 10:16
Prototypal inheritance used to define states.
/*! (c) 2016 Andrea Giammarchi - MIT Style License */
// simple state-like objects handler
// based on prototypal inheritance
function State() {'use strict';}
// States are serializable dictionaries
// toJSON and toString are the only reserved keywords
// every other name can be used as name (included __proto__)