Skip to content

Instantly share code, notes, and snippets.

<script src="includes.js" runat="edge"></script>
<html>
<script runat="edge">Mixer('header.html');</script>
<body>
<script runat="edge">
Mixer('nav2.html', {
timeout: 200, //in ms
errors : {default: 'Failed', not_found: 'Content not found', timeout: 'Content timed out'}
});
In 2009, the offices will be closed on the following holidays:
* Jan 1 New Year's Day
Jan 2 Day after New Year’s Day
Jan 19 MLK, Jr. Day
Feb 16 President’s Day
* May 25 Memorial Day
* Jul 3 Day before Independence Day
* Sept 7 Labor Day
* Nov 26 Thanksgiving Day
Nov 27 Day after Thanksgiving Day
import re
class Parser:
__js_block = re.compile(r"(<script.+?runat=\"proxy\".*?>)(.*?)(</script>)")
__script_start = re.compile(r"<script.+?runat=\"proxy\".*?>")
__script_end = "</script>"
def __init__(self, raw):
self.data = Parser.__js_block.split(raw)
cruise@asharite:/var/lib/cruise-server/pipelines/ars-shortener/ars_shortener$ ./manage.py syncdb --settings=ars_shortener.settings_live
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 340, in execute_manager
utility.execute()
File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 192, in run_from_argv
self.execute(*args, **options.__dict__)
11:08 -!- Irssi: Starting query in arstechnica with pax_romana
11:08 <MrKurt> help
11:08 -Pax_Romana([email protected])- Pax_Romana allows Operators/Administrators with access, to
11:08 -Pax_Romana([email protected])- maintain control on the network.
11:08 -Pax_Romana([email protected])- For more information on the commands, type
11:08 -Pax_Romana([email protected])- /msg Pax_Romana HELP <command>
11:08 -Pax_Romana([email protected])-
11:08 -Pax_Romana([email protected])- HELP Display this screen
11:08 -Pax_Romana([email protected])- IDENTIFY Identify with Pax_Romana with your password
11:08 -Pax_Romana([email protected])- * * * *
import os
def civis():
config.fab_hosts = ['[email protected]']
config.path = '/var/web-apps/civis.ars/'
config.package_name = "civis.tar.gz"
def copy_files():
if config.package_name == "civis.tar.gz":
put("output/$(package_name)", "$(path)tmp/$(package_name)", fail=abort)
<script src="includes.js" runat="proxy"></script>
<html>
<script runat="proxy">Mixer('header.html');</script>
<body>
<script runat="proxy">
Mixer('nav.html', {
timeout: 200, //in ms
errors : {generic: 'Failed', not_found: 'Content not found', timeout: 'Content timed out'}
});
Mixer.append_raw_from_array(0);
// Including: includes.js
Mixer.append_raw_from_array(4);
Mixer('header.html');
Mixer.append_raw_from_array(8);
Mixer('nav.html', {
timeout: 200, //in ms
errors : {generic: 'Failed', not_found: 'Content not found', timeout: 'Content timed out'}
});
class TestRunner(unittest.TestCase):
def test_simple_js(self):
result = Runner().run_js('"kurt rocks";')
self.assertEqual(result, 'kurt rocks')
def test_longer_js(self):
result = Runner().run_js('var blah = "kurt rocks";\nblah;')
self.assertEqual(result, 'kurt rocks')
def test_complex_return(self):
def assemble_result(self, raw = None):
if not self.__extractor and not raw:
raise Error, "No source to work with"
elif raw:
self.__extractor = Extractor(raw)
result = self.run_js()
data = self.__extractor.data
output = ''