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
SSJSWriter (str, request, response, file, lastMod, sessionId) -> | |
parsedTextArray = [] | |
externalParsedTextArray = [] | |
startTag = globalSettings.server_script.begin | |
startWriteAddition = globalSettings.server_script.write | |
startGlobalAddition = globalSettings.server_script.global | |
endTag = globalSettings.server_script.end | |
lineArray = str.split(new RegExp( "\n", "g" )) | |
isInScript = no |
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
Todos.Task = SC.Record.extend( | |
/** @scope Todos.Task.prototype */ { | |
isDone: SC.Record.attr(Boolean), | |
description: SC.Record.attr(String), | |
}) ; |
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
~/myapps/todos$ find | grep coffee$ | |
./apps/todos/fixtures/task.coffee | |
./apps/todos/main.coffee | |
./apps/todos/models/task.coffee | |
./apps/todos/resources/main_page.coffee |
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
#! /usr/bin/env ipy | |
import os | |
folder = r'\\s02axiprod02\events' | |
for (path, dirs, files) in os.walk(folder): | |
for file in files: | |
print os.path.join(path, file) |
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
myVal = r'input="lolwut"' | |
myVal = myVal.split('=') | |
myVal[1] = myVal[1].replace('"', '') #remove doublequote | |
myDict = {} | |
myDict.update({ myVal[0]: myVal[1] }) | |
print myDict.get('input') | |
# prints lolwut |
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
""" | |
See the python docs for more on file writes: | |
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files | |
""" | |
import urllib | |
img = urllib.urlopen(r'http://www.google.com/logos/2010/xraydiscovery2010-res.gif') | |
f = open ('/pythonwrite.gif', 'wb') # wb = binary write mode |
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
import turtle | |
def drawPolygon(sides, fillcolor='DarkOliveGreen'): | |
init pen | |
turtle.reset() | |
turtle.fillcolor(fillcolor) | |
turtle.fill(True) | |
#draw a shape | |
degree = 360.0 / sides |
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
import clr | |
clr.AddReference('System.DirectoryServices') | |
from System.DirectoryServices import ( | |
DirectorySearcher, | |
DirectoryEntry | |
) | |
filter = "(&(objectCategory=person)(objectClass=user)(givenName=wes*))" |
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
import feedparser, re #feedparser available at http://feedparser.org/ | |
def search_fatwallet(keyword): | |
fw = feedparser.parse(r'http://feeds.feedburner.com/FatwalletHotDeals') | |
for entry in fw.entries: | |
if re.search(keyword, entry['title']): | |
print entry['title'], '\n', entry['feedburner_origlink'] | |
print '' | |
""" | |
>>> search_fatwallet('car') |
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
import time, datetime, feedparser | |
ebay = feedparser.parse(r'http://shop.ebay.com/i.html?rt=nc&_nkw=squinkies&_rss=1') | |
def timeleft(in_time): | |
then = int(in_time[:-3]) | |
now = int(time.time()) | |
delta = then - now | |
#print time.gmtime(then) #sanity debug | |
return ' '.join([str(delta / 3600), "hours", str((delta % 3600) / 60), \ |