This file contains 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
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast) | |
(function poll(){ | |
$.ajax({ url: "server", success: function(data){ | |
//Update your dashboard gauge | |
salesGauge.setValue(data.value); | |
}, dataType: "json", complete: poll, timeout: 30000 }); | |
})(); |
This file contains 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
From: http://www.chromium.org/developers/design-documents/network-stack/socks-proxy | |
To configure chrome to proxy traffic through the SOCKS v5 proxy server myproxy:8080, launch chrome with these two command-line flags: | |
--proxy-server="socks5://myproxy:8080" | |
--host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE myproxy" | |
The first thing to check when debugging is look at the Proxy tab on about:net-internals, and verify what the effective proxy settings are: | |
chrome://net-internals/#proxy |
This file contains 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
<?php | |
$image = imagecreatefromjpeg($_GET['src']); | |
$filename = 'images/cropped_whatever.jpg'; | |
$thumb_width = 200; | |
$thumb_height = 150; | |
$width = imagesx($image); | |
$height = imagesy($image); |
This file contains 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 isType(arg, type) { | |
type = type.charAt(0).toUpperCase() + type.substr(1); | |
return Object.prototype.toString.call(arg) == '[object ' + type + ']'; | |
} |
This file contains 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
/* JSONPath 0.8.0 - XPath for JSON | |
* | |
* Copyright (c) 2007 Stefan Goessner (goessner.net) | |
* Licensed under the MIT (MIT-LICENSE.txt) licence. | |
*/ | |
function jsonPath(obj, expr, arg) { | |
var P = { | |
resultType: arg && arg.resultType || "VALUE", | |
result: [], | |
normalize: function(expr) { |
This file contains 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
// http://stackoverflow.com/questions/7279567/how-do-i-pause-a-window-setinterval-in-javascript | |
function RecurringTimer(callback, delay) { | |
var timerId, start, remaining = delay; | |
this.pause = function() { | |
window.clearTimeout(timerId); | |
remaining -= new Date() - start; | |
}; |
This file contains 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
#!/bin/bash | |
# Before using please rename from post-commit.sh to post-commit | |
# Add this file to the hooks directory in the svn root folder | |
REPOS="$1" | |
REV="$2" | |
# A - Item added to repository | |
# D - Item deleted from repository | |
# U - File contents changed |
This file contains 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
.center { | |
postion: absolute; | |
left: 50%; | |
transform: translateX(-50%); | |
} |
This file contains 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
/* | |
* Date Format 1.2.3 | |
* (c) 2007-2009 Steven Levithan <stevenlevithan.com> | |
* MIT license | |
* | |
* Includes enhancements by Scott Trenda <scott.trenda.net> | |
* and Kris Kowal <cixar.com/~kris.kowal/> | |
* | |
* Accepts a date, a mask, or a date and a mask. | |
* Returns a formatted version of the given date. |
NewerOlder