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
// 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
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
// How to get client ip address with jQuery | |
$.getJSON("http://jsonip.appspot.com?callback=?",function(data){ | |
alert( "Your ip: " + data.ip); | |
}); | |
// How to parse XML with jQuery | |
// file.xml: |
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
//store the URL | |
var url = "http://vimeo.com/71673549"; | |
//extract the ID | |
var rgx = /\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; | |
//the ID: 71673549 | |
var id = url.match(rgx); | |
var width = '640'; |
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() { | |
var f = []; | |
$.ajax({ | |
url: "imgz.js", | |
type: "GET", | |
contentType: "json", | |
cache: true, | |
success: function(data) { | |
var j = JSON.parse(data); | |
var $c = $("#container"); |
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
var http = require('http'); | |
var https = require('https'); | |
/** | |
* @name deviant.js | |
* @author Peter Lejeck <[email protected]> | |
* @description deviantJS, handles the process of logging in. | |
* @version 0.1 | |
*/ |
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
<html> | |
<head> | |
<title>Event Hub</title> | |
<script src="hub.js"></script> | |
<script> | |
var subscription = hub.subscribe('/go', function(params) { | |
console.log('one', params); | |
}); | |
var subscription2 = hub.subscribe('/go', function(params) { | |
console.log('two', params); |
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
// GTRX geolocator | |
(function GTRX(window) { | |
var wndw = window, | |
var startG = function() { | |
if (wndw.navigator.geolocation) { | |
var trxLST = [], pID = "", cnt = 0, ipAddrs = ""; |