This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static unsafe void sniffColors(Bitmap bmp, | |
byte r, byte g, int b, int heft) | |
{ | |
BitmapData dta = image.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), | |
ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); | |
int bPxl=3; | |
byte* chk1=(byte*)imageData.Scan0.ToPointer(); | |
int trn=imageData.Stride; | |
int hgt=imageData.Height; | |
int wdt=imageData.Width; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// month type options | |
<input type="month" list="months" /> | |
<datalist id="months"> | |
<option label="Eiji's birthday">1976-02</option> | |
<option label="End of last century">2000-12</option> | |
<option>2010-01</option> | |
<option label="Now">2012-11</option> | |
</datalist> | |
// week options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map(func, array) { | |
var len = array.length; | |
var rst = new Array(len); | |
for (var i = 0; i < len; i++) | |
rst[i] = func(array[i]); | |
return rst; | |
} | |
function reduce(func, start, array) { | |
var len = array.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// on every "yada" in "yada".... | |
function onEachIn(object, action) { | |
try { | |
for (var property in object) { | |
if (Object.prototype.hasOwnProperty.call(object, property)) | |
action(property, object[property]); | |
} | |
} catch (e) { | |
throw e; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my for-each thing | |
function forEeach(array, action) { | |
try { | |
var len = array.length; | |
for (var i = 0; i < len; i++) | |
action(array[i]); | |
} catch (e) { | |
throw e; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create event | |
var minE = new CustomEvent("yourEventName", { | |
detail: { | |
"key": value | |
}, | |
bubbles: true, | |
cancelable: true | |
}); | |
//add handler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converts image to canvas; returns new canvas element | |
function Img2Cnvs(image) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = image.width; | |
canvas.height = image.height; | |
canvas.getContext("2d").drawImage(image, 0, 0); | |
return canvas; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clone(src) { | |
function mixem(src, dst, fnc) { | |
var i, em, nm, j = {}; | |
for(nm in src){ | |
j = src[nm]; | |
if(!(nm in dst) || (dst[nm] !== j && (!(nm in em) || em[nm] !== j))){ | |
dst[nm] = fnc ? fnc(s) : j; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function worker() { | |
setInterval(function() { | |
postMessage({foo: "bar"}); | |
}, 1000); | |
} | |
var code = worker.toString(); | |
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}")); | |
var blob = new Blob([code], {type: "application/javascript"}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- clock widget exmple --> | |
<!DOCTYPE html> | |
<html> | |
<head runat="server"> | |
<meta charset="utf-8"> | |
<title></title> | |
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script> |