Skip to content

Instantly share code, notes, and snippets.

@jayzeng
jayzeng / bingMap.js
Created March 17, 2011 17:38
Displays a series pins with an index number and set a central point base upon all pins
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.pushpin {position: absolute; text-align: center; width: 100%; font: normal normal bold 10pt/normal Arial, Helvetica, sans-serif; color: rgb(255, 255, 255); left: 0px; top: 5px;}
</style>
<script src="http://prototypejs.org/assets/2009/8/31/prototype.js"></script>
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1"></script>
<script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en" type="text/javascript" charset="UTF-8"></script>
</head>
<body onload="init();">
<div id="myMap" style="position: relative; width: 600px; height: 450px;"></div>
@jayzeng
jayzeng / gist:883776
Created March 23, 2011 19:33
bing map
window.Microsoft = window.Microsoft || {};
window.Microsoft.Maps = window.Microsoft.Maps || {};
window.Microsoft.Maps.initMapDelayCode = function () {
var K = 'Invalid Credentials. Sign up for a developer account at: <a href="http://www.microsoft.com/maps/developers">http://www.microsoft.com/maps/developers</a>',
M = "{num} km",
Y = "{num} m",
ab = "{num} miles",
bb = "{num} yds",
db = "{num} feet",
X = "Click to pan in any direction",
var require, define;
(function () {
function getInteractiveScript() {
var a, b, c;
if (interactiveScript && interactiveScript.readyState === "interactive") return interactiveScript;
a = document.getElementsByTagName("script");
for (b = a.length - 1; b > -1 && (c = a[b]); b--) if (c.readyState === "interactive") return interactiveScript = c;
return null
}
function newContext(contextName) {
@jayzeng
jayzeng / process.py
Created August 15, 2011 02:34
Intelius Xml and php config class processor
#!/usr/bin/python -tt
# @author Jay Zeng
# @since 8/14/2011
# Utility to dynamically re-construct file
#
# Input -> output:
# summary_intelius-2011-06-07_m27744-three-headlines-good-news-null.xml -> summary_m27744-three-headlines-good-news-null.xml
# class
# change file name and class name
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end
@jayzeng
jayzeng / repo.py
Last active December 11, 2015 02:59
repo set up
#!/usr/bin/python
import subprocess
devs = {}
devs['jayzeng'] = 'jayzeng'
devs['davidremm'] = 'davidremm'
devs['beau'] = 'beauhoyt'
devs['yanmei'] = 'wyiemay'
devs['niek'] = 'nieksand'
devs['lee'] = 'leehasoffers'
<?php
// Duck typing
class Car
{
public function run() {
return 'car is running';
}
}
<?php
class IpV4Validator
{
private $_ip;
public function __construct( $ipAddr ) {
$this->_ip = $ipAddr;
}