Skip to content

Instantly share code, notes, and snippets.

@pytest.mark.usefixtures("appsettings")
class TestUtilsTemplate(object):
def setup_method(self, method):
self.request = testing.DummyRequest()
self.config = testing.setUp(settings=self.appsettings, request=self.request)
def teardown_method(self, method):
testing.tearDown()
from . import views
def main(global_config, **settings):
#trimmed for length
config.add_route('home', '/')
config.add_view(views.home, route_name='home', xhr=False, decorator=views.AngularWrapper, renderer='index.mako')
config.add_view(views.home, route_name='home', xhr=True, renderer='json')
return config.make_wsgi_app()
from . import views
def main(global_config, **settings):
#trimmed for length
config.add_route('home', '/')
config.add_view(views.AngularWrapper(views.home), route_name='home', xhr=False, renderer='index.mako')
config.add_view(views.home, route_name='home', xhr=True, renderer='json')
return config.make_wsgi_app()
Leeuwenhoek.historyView = Em.View.create({
templateName: 'history-view',
inSetupModeBinding: 'Leeuwenhoek.historyController.inSetupMode'
});
Leeuwenhoek.SetupHistoryView = Em.View.extend({
templateName: 'setup-history-view',
historyBinding: 'Leeuwenhoek.historyController.content',
firstEra: Em.computed(function() {
// get the first era out of the history
@inklesspen
inklesspen / README.md
Created January 27, 2012 22:21
Updated PDF bookmarks for Legends of the Wulin

Legends of the Wulin is a beautiful book, but it lacks usable PDF bookmarks. So I made better ones. You can apply them to your copy by following these directions. I did these on Mac OS X, but it shouldn't be too hard to do the same thing on other Unix-like systems or Windows. You will need to be somewhat comfortable with command-line operations; consult http://learncodethehardway.org/cli/ if you need to brush up on your skills.

  1. Legally acquire a copy of the Legends of the Wulin PDF. These bookmarks were made to suit the version 5 PDF from drivethrurpg.
  2. Decrypt the PDF; necessary so that it can be edited. I used http://qpdf.sourceforge.net/ for this. There are windows binaries available for download; it will need to be compiled for Unix-like systems. Packages exist for Debian testing, Macports, and Homebrew. Read the documentation to find the decryption command.
  3. Download JPdfBookmarks 2.5.2 from http://flavianopetrocchi.blogspot.com/. Consult the manual (http://sourceforge.net/apps/mediawiki/jpdfbook
leeuwenhoek.models.Scene = Backbone.Model.extend({
defaults: {
'question': 'What?',
'setting': 'Where, when, and who?',
'answer': 'What?',
'tone': 'light'
}
});
leeuwenhoek.models.SceneList = Backbone.Collection.extend({
model: leeuwenhoek.models.Scene
@inklesspen
inklesspen / gist:887715
Created March 25, 2011 21:57
This is the IMAP 4 stream I get when I delete messages in iPad's Mail.app. Thunderbird doesn't seem to register the deletions until I quit and restart; even hitting Get Mail does nothing to fix it.
. select inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk JunkRecorded $Junk No
tJunk $Forwarded Junk NonJunk)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk JunkReco
rded $Junk NotJunk $Forwarded Junk NonJunk \*)] Flags permitted.
* 24 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1096349090] UIDs valid
* OK [UIDNEXT 37742] Predicted next UID
* OK [HIGHESTMODSEQ 30616] Highest
@Override
public void onPlayerJoin(PlayerEvent event) {
Player player = event.getPlayer();
Location home = plugin.getPlayerHome(player);
if (home != null) {
player.setCompassTarget(home);
}
}
@Override
OPS[ADD] = new Opcode(ADD, "add", 2, 1) {
public void handle(long[] args) {
args[2] = (args[0] + args[1]) & 0xFFFFFFFF;
// Alternate version
// args[2] = (long) ((int) args[0] + (int) args[1]);
}
};
package com.inklesspen.firejam;
public class IntTypes {
public static void main(String[] args) {
long a = 4294967285L;
System.out.println(a);
int b = (int) a;
System.out.println(b);
int c = b + 100;
System.out.println(c);