This file contains hidden or 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
{ | |
"suc": true, | |
"data": { | |
"cityView": { | |
"name": "Metropolis", | |
"money": 673511, | |
"stone": 750, | |
"stone_capacity_percent": 75, | |
"food": 735, | |
"food_capacity_percent": 73, |
This file contains hidden or 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 vRecur(icalendar.vRecur): | |
"""Fix vRecur so the frequency comes first""" | |
def ical(self): | |
# SequenceTypes | |
result = ['FREQ=%s' % self.types['FREQ'](self['FREQ']).ical()] | |
for key, vals in self.items(): | |
if key == 'FREQ': | |
continue | |
typ = self.types[key] | |
if not type(vals) in icalendar.prop.SequenceTypes: |
This file contains hidden or 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
// ==UserScript== | |
// @name AutoReviewComments | |
// @namespace benjol | |
// @version 1.2.0 | |
// @description Add pro-forma comments dialog for reviewing (pre-flag) | |
// @include http://*stackoverflow.com/questions* | |
// @include http://*stackoverflow.com/review* | |
// @include http://*stackoverflow.com/admin/dashboard* | |
// @include http://*serverfault.com/questions* | |
// @include http://*serverfault.com/review* |
This file contains hidden or 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 CommandStorage(object): | |
"""Stores multi-part commands. | |
Performs fast lookups returning the command and any arguments which were | |
not part of the command. | |
>>> cs = CommandStorage() | |
>>> cs | |
<CommandStorage([])> | |
>>> cs['playlist off'] = 'func_playlist_off' |
This file contains hidden or 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 flask.ext.irc import BotModule, CommandAborted | |
from exodus import login_required, db | |
auth = BotModule('Auth', __name__) | |
@auth.command('addhost') | |
def addhost(source, channel): | |
"""Show the URL to connect your host with your account. | |
This command shows you the URL to associate your hostname with an account. |
This file contains hidden or 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
# vim: fileencoding=utf8 | |
"""Privilege system. | |
Stores boolean privileges which can be put in nested groups. | |
By default all privileges "bubble", i.e. they enable all (bubbling) parent | |
groups. When a group is set in a privilege set all children are set to the | |
same state. Basically a group is considered active when it has at least one | |
bubbling privilege/group that is active. |
This file contains hidden or 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 moveScroller() { | |
var width = $('#scroller').width(); | |
var move = function () { | |
var st = $(window).scrollTop(); | |
var ot = $('#scroller-anchor').offset().top; | |
var s = $('#scroller'); | |
if (st > ot) { | |
if (s.height() > $(window).height()) { | |
s.css({ 'position': 'fixed', 'top': '', 'bottom': '0px', 'width': width }); |
This file contains hidden or 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
/* Copy a regular file from SRC_NAME to DST_NAME. | |
If the source file contains holes, copies holes and blocks of zeros | |
in the source file as holes in the destination file. | |
(Holes are read as zeroes by the `read' system call.) | |
When creating the destination, use DST_MODE & ~OMITTED_PERMISSIONS | |
as the third argument in the call to open, adding | |
OMITTED_PERMISSIONS after copying as needed. | |
X provides many option settings. | |
Return true if successful. | |
*NEW_DST is as in copy_internal. |
This file contains hidden or 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 SocketServer import TCPServer | |
from OpenSSL import SSL | |
def patch_shutdown_request(): | |
# Fix SocketServer's shutdown not working with pyopenssl | |
def my_shutdown_request(self, request): | |
"""Called to shutdown and close an individual request.""" | |
try: | |
#explicitly shutdown. socket.close() merely releases | |
#the socket and waits for GC to perform the actual close. |
This file contains hidden or 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
<?php | |
error_reporting(E_ALL|E_STRICT); | |
function crap(&$var) { | |
echo '$var='.$var."\n"; | |
$var = 'x'; | |
} | |
crap($x = 123); | |
# Strict Standards: Only variables should be passed by reference in php shell code on line 1 |
OlderNewer