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 () { | |
var result=0; | |
var text = prompt("Find",''); | |
function find (node) { | |
if (node.nodeType == 1) { | |
var children = node.childNodes; | |
for (var i=0;i<children.length;i++) { | |
var child = children[i]; | |
var res = find(child); |
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 python | |
import sys | |
import urllib | |
input = open(sys.argv[1]).read() | |
print 'javascript:' + urllib.quote(input) |
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
D = Draw bridge | |
C = Cage trap | |
W = Weapon trap | |
S = Stone fall trap | |
B = Normal retracting bridge | |
<- Entrance | |
|DDD| <- draw bridge that acts like a portcullis | |
|CCC| |
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
def get_ifcs(links,rec=2): | |
return ifilter(lambda x: x!=None,chain(*[chain([link.ifc1,link.ifc2],get_ifcs(link.ordered_provider_links,rec-1)) for link in links]) if rec > 0 else []) |
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 simplejson as json | |
from lxml import etree | |
def is_node_badger_array(node): | |
if len(node) <= 1: | |
return False | |
for (a,b) in zip(node,node[1:]): | |
if a.tag != b.tag: | |
return False |
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
""" | |
Copyright 2006 ThoughtWorks, Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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 python | |
import json | |
import sys | |
# useful when used with backticks like: python manage.py dumpdata --indent=4 `fixture_models your_fixture.json` | |
data = None | |
with open(sys.argv[1]) as json_file: | |
data = json.load(json_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
#!/bin/bash | |
# Put this in ~/bin/ps1, and make it executable | |
# Then add the following line to your .bashrc or .bash_profile: | |
# PROMPT_COMMAND="source $HOME/bin/ps1" | |
HG_BRANCH=`hg branch 2>&1` | |
if [[ $? == 0 ]] | |
then | |
VCS_PROMPT="\[\033[00;33m\](\[\033[00;37m\]$HG_BRANCH\[\033[00;33m\]) \[\033[01;34m\]" | |
else |
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 sys | |
import re | |
import subprocess | |
from functools import partial | |
class TracebackParser(object): | |
traceback_line_re = re.compile(r'\s+File\s+\"([^"]*)\"') | |
def __init__(self, on_traceback=None): | |
self.in_traceback = False |
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 IPython.kernel.zmq.kernelapp import IPKernelApp | |
from IPython.utils.frame import extract_module_locals | |
import sys | |
# Code lifted from IPython/kernel/zmq/embed.py | |
def embed_kernel_noloop(module=None, local_ns=None, **kwargs): | |
"""Embed and start an IPython kernel in a given scope | |
returning function that can be used to pump a single event | |
Parameters |
OlderNewer