Skip to content

Instantly share code, notes, and snippets.

View shimondoodkin's full-sized avatar

Shimon Doodkin shimondoodkin

View GitHub Profile
@shimondoodkin
shimondoodkin / InnerHTMLie6.js
Created January 7, 2013 15:47
InnerHTML & setAttribute for ie6-ie8 that do not suffer from restriction
//innerHTML of these elements in internet explorer are read only:
//COL, COLGROUP, FRAMESET, HEAD, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR, SELECT.
//example:
// function createtable(deal)
// {
// var table = document.createElement('table');
// table.className='infotable';
// //table.innerHTML='<tbody><tr><td>123</td></tr></tbody>' // will not work in internet explorer
// setInnerHTML(table,'<tbody><tr><td>123</td></tr></tbody>')
//licence: 2 clouse mit, by Shimon Doodkin
function ObserverPubSub(parent, key_of_myself) {
this._topics = {};
this.length = 0;
this._subUid = -1;
this._parent = parent;
this._name = key_of_myself;
}
ObserverPubSub.prototype = {
@shimondoodkin
shimondoodkin / xml2-config.bat
Created December 20, 2012 00:09
libxml2 xml2-config translated to .bat
@ECHO OFF
rem libxml2-2.7.8.win32.zip can be downloaded from ftp://xmlsoft.org/libxml2/win32/libxml2-2.7.8.win32.zip
setlocal ENABLEDELAYEDEXPANSION
rem http://batcheero.blogspot.co.il/2007/06/how-to-enabledelayedexpansion.html - windows xp
SET SELFDIR=%~dp0
IF %SELFDIR:~-1%==\ SET SELFDIR=%SELFDIR:~0,-1%
set SELFDIR=%SELFDIR:\=/%
@shimondoodkin
shimondoodkin / chat.js
Created November 14, 2012 13:22
nodejs express 3 integration of - socket.io with sessions and sessionid handshake
/**
* Module dependencies.
*/
var express = require('express')
// , routes = require('./routes')
// , user = require('./routes/user')
, http = require('http')
, path = require('path');
@shimondoodkin
shimondoodkin / http.vbs
Last active March 23, 2023 04:51
excel vba xmlhttp with cookies, asynchronous, and with proxy support
' asynchronious http and synchronius http
' depends on Timer module
' ADD a referece to "Microsoft WinHTTP Services, version 5.1" (in Tools-> References)
Private Const CP_UTF8 = 65001
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
' http jobs example - async http
'Public Sub testasync_steps(Optional userarg As Variant = "", Optional step As Variant = 0, Optional data As String = "", Optional cookie As String = "", Optional haderror As Boolean = False)
@shimondoodkin
shimondoodkin / app.js
Created July 14, 2012 15:47
node.js express integrated with socket io, also with mysql and basic auth.
/**
* Module dependencies.
*/
var io = require('socket.io')
, sio, sio_client_on
, express = require('express')
, MemoryStore = express.session.MemoryStore
, routes = require('./routes')
, sessionStore = new MemoryStore();
@shimondoodkin
shimondoodkin / doors_game.js
Created March 6, 2012 16:03
in game theory there is an idea about the old tv show of 3 doors where you choose a door and then the showman says there is nothing behind that door you did not choose. would you like to switch? the idea saya that if you switch you should have more chance
var doors=7;
function offerdoors()
{
if(doors<3) return "error";
var arr=[];for(var d=0;d<doors;d++)arr[d]=0;// fill the rage
arr[Math.floor(Math.random()*3)]=1;
choose(arr)
}
function whereno(arr,choice)
{
@shimondoodkin
shimondoodkin / cron.js
Created February 27, 2012 20:18
javascript cron can be used in node.js
/*
Added complex matches by Shimon Doodkin 2012
Developed by Elijah Rutschman 2009 - http://elijahr.blogspot.com/2009/03/javascript-cron.html
*/
/*
a typical cron entry has either wildcards (*) or an integer:
.---------------- minute (0 - 59)
| .-------------- hour (0 - 23)
| | .------------ day of month (1 - 31)
@shimondoodkin
shimondoodkin / nodehello.bat
Created February 16, 2012 02:26
Apache prunsrv - run nodejs as windows service
:: to download Procrun binaries and see documentation visit http://commons.apache.org/daemon/procrun.html
:: this file is used to Reinstall a service each time you run it,
:: if you need to uninstall comment out with "::" the install service line
::detect x86 or x64
echo off
IF PROCESSOR_ARCHITECTURE EQU "ia64" GOTO IS_ia64
IF PROCESSOR_ARCHITEW6432 EQU "ia64" GOTO IS_ia64
IF PROCESSOR_ARCHITECTURE EQU "amd64" GOTO IS_amd64
@shimondoodkin
shimondoodkin / app.js
Created February 13, 2012 19:35
json database for node.js , preserves recursive data structures. may need a cleanup a little bit.
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
var app = module.exports = express.createServer();