Skip to content

Instantly share code, notes, and snippets.

View maethu's full-sized avatar
😎

Mathias Leimgruber maethu

😎
View GitHub Profile
@lukasgraf
lukasgraf / trace_register.py
Created October 11, 2015 15:34
CSRF debug helper: Trace object registrations
"""Helper to trace ZODB object registrations in order to debug CSRF false
positives with plone.protect.
This helper is intended for DEBUGGING, not for use in production!
"""
from collections import namedtuple
from functools import partial
from threading import local
from ZODB.utils import u64
@maethu
maethu / uncatalog_if_no_uid.py
Last active February 5, 2019 19:19
uncatalog_if_no_uid.py
def uncatalog_by_rid(_catalog, rid):
data = _catalog.data
paths = _catalog.paths
indexes = _catalog.indexes.keys()
for name in indexes:
x = _catalog.getIndex(name)
if hasattr(x, 'unindex_object'):
x.unindex_object(rid)
del data[rid]
del paths[rid]
@iambibhas
iambibhas / scopes.txt
Last active June 16, 2024 20:45
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')