Skip to content

Instantly share code, notes, and snippets.

class ExtractRelevantTextNode(template.Node):
def __init__(self, field_name, query, fieldtext):
self.field_name, self.query, self.fieldtext = field_name.strip(), query.strip(), fieldtext.strip()
def render(self, context):
efffield_name = Variable(self.field_name).resolve(context)
effquery = Variable(self.query).resolve(context)
efffieldtext = Variable(self.fieldtext).resolve(context)
if type(self.query) == type(u""):
effquery = lucene.QueryParser(efffield_name, lu.getAnalyzer()).parse(effquery)
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>c:log</title>
<meta http-equiv="Content-Type" content="text/xhtml+xml; charset=utf-8" />
<meta http-equiv="Refresh" content="86400" />
<meta name="verify-v1" content="03vYOCHSB0pI40Ihad5a/UxwepMxjnAd94XpxTYpSTQ=" />
<link rel="stylesheet" href="/css/index.css" type="text/css" title="default.white" />
<script type="text/javascript" src="/scripts/concert.js"></script>
do
local mem = collectgarbage("count")
local s = "Hi"
for t=1,1000 do
x = function() print(s) end
end
ChatFrame1:AddMessage("Used: "..(collectgarbage("count") - mem))
end
/*probando*/
module Merb::Cache
class MutexFetchStore < StrategyStore
def initialize(config = {})
super(config)
@interval = config[:sleep_interval] || 0.1
@timeout = config[:timeout] || 0.5
end
def writable?(key, parameters = {}, conditions = {})
contexts.any? {|c| c.writable?(key, parameters, conditions)}
# current code:
unless @users = cache_get("active_users")
@users = User.all(:active => true)
cache_set("active_users", @users)
# object caching can be used to avoid pulling huge amounts of data
# from the database.
# you could have calle cache_set with an expiration time as well:
# cache_set("active_users", @users, 10)
end
# current code:
unless @users = cache_get("active_users")
@users = User.all(:active => true)
cache_set("active_users", @users)
# object caching can be used to avoid pulling huge amounts of data
# from the database.
# you could have calle cache_set with an expiration time as well:
# cache_set("active_users", @users, 10)
end
how to do stuff
totally hotness
We couldn’t find that file to show.
An Evil Gist!