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 geocoder = new google.maps.Geocoder(); | |
/* use Google Geocoder in jQueryUI autocomplete widget */ | |
$("#search").autocomplete({ | |
minLength:8, | |
source:function(request,response) { | |
geocoder.geocode({address:request.term}, function(result,status){ | |
var addresses = jQuery.map(result, function(address){ return address.formatted_address; }); | |
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
component output="no" name="qr" { | |
function encode(required string message) { | |
var url = "http://chart.apis.google.com/chart"; | |
url &= "?cht=qr&chs=200x200"; | |
url &= "&chl=#message#"; | |
return image_tag(url,200,200,message); | |
} | |
function image_tag(url,w,h,alt) { |
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
USE AdventureWorks2008; | |
WITH ShippingTime(OrderDate,ShipDate,DaysToShip) AS | |
( | |
SELECT OrderDate, ShipDate,DATEDIFF(day,OrderDate,ShipDate) | |
FROM Sales.SalesOrderHeader | |
) | |
SELECT * | |
FROM ShippingTime; |
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
<h2>Server: <cfoutput>#CGI.SERVER_NAME#</cfoutput></h2> | |
<p> | |
The following ColdFusion DSN's are available on this server: | |
</p> | |
<cfscript> | |
// Instantiate CF Admin API | |
adminObj = createObject("component","cfide.adminapi.administrator"); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href="grid.css" type="text/css" rel="stylesheet" /> | |
<style type="text/css"> | |
p {border:1px solid black;} | |
.container_12 {background:#ddd; } | |
body{background:#ccc; } | |
</style> | |
</head> |
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
""" | |
Decode a super-secret message | |
""" | |
import sys | |
from string import maketrans | |
# setup translation | |
in_wrds = "abcdefghijklmnopqrstuvwxyz" | |
out_wrds = "cdefghijklmnopqrstuvwxyzab" | |
trans_tbl = maketrans(in_wrds, out_wrds) |
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
# solution 1 - nested loops | |
temp = "" | |
f = open('mess.txt', 'r') | |
for l in f: | |
for c in l: | |
if c.isalpha(): | |
temp += c | |
print temp | |
# solution 2 - list comprehension |
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
import re | |
import gdata.photos.service | |
user = 'intakescreensinc' | |
service = gdata.photos.service.PhotosService() | |
tags = service.GetUserFeed(user=user, kind='tag').entry | |
cfs = re.compile("^(\d+)cfs$") | |
cfs_sizes = [] | |
for tag in tags: |
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
import re | |
import gdata.photos.service | |
class Collection: | |
def __init__(self, username): | |
self.feed = "/data/feed/api/user/%s" % username | |
self.service = gdata.photos.service.PhotosService() | |
def fetch(self, feed): | |
"""Make a call to the photo service.""" | |
return self.service.GetFeed(feed) |
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
#!/bin/sh | |
# Amazon Linux AMI startup script for a supervisor instance | |
# | |
# chkconfig: 2345 80 20 | |
# description: Autostarts supervisord. | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
supervisorctl="/usr/bin/supervisorctl" |