Discover gists
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
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) |
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
<?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> |
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
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 | |
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
/*probando*/ |
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
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)} |
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
# 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 |
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
# 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 |
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
how to do stuff | |
totally hotness |
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
An Evil Gist! |