Skip to content

Instantly share code, notes, and snippets.

View datakurre's full-sized avatar

Asko Soukka datakurre

View GitHub Profile
@inian
inian / unregister.js
Last active June 2, 2018 08:20
Unregister Dexecure Service Worker registrations
try {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
registrations.forEach(function(registration) {
if (registration.active && registration.active.scriptURL.includes("dexecure")) {
console.log('removing registration', registration);
registration.unregister();
}
})
})
} catch (e) {
@rvl
rvl / test-docker.nix
Last active September 28, 2020 23:22
Examples of using nixpkgs PR 11156 https://github.com/NixOS/nixpkgs/pull/11156
# How to build docker images (NIX_PATH and hydra cache required when building off master branch)
# export NIX_PATH=$HOME/dev
# nix-build --option extra-binary-caches http://hydra.nixos.org/ test-docker.nix | xargs -n1 docker load -i
with import <nixpkgs> {};
rec {
# 1. basic example
bash = dockerTools.buildImage {
name = "bash";
@thet
thet / instancebehaviors.py
Created November 1, 2012 00:04
plone/dexterity per-instance behaviors
"""Per instance behaviors for Plone's Dexterity.
<adapter
for=".interfaces.IBasetype"
factory=".instancebehaviors.DexterityInstanceBehaviorAssignable" />
Also see:
http://opkode.net/media/blog/plone-and-dexterity-enable-behaviors-per-content-type-instance
"""
Index: src/infrae/wsgi/publisher.py
===================================================================
--- src/infrae/wsgi/publisher.py (revision 49248)
+++ src/infrae/wsgi/publisher.py (working copy)
@@ -19,6 +19,7 @@
from zope.component import queryMultiAdapter
from zope.event import notify
from zope.interface import implements
+from zope.interface import directlyProvides, directlyProvidedBy
from zope.site.hooks import getSite
<target name="jasmine" description="Run unit tests with Jasmine">
    <exec executable="${basedir}/tests/js/jasmine-reporters/test/phantomjs.runner.sh">
        <env key="DISPLAY" value=":0" />
        <arg line="${basedir}/tests/js/jasmine-reporters/test/JUnitRunner.html"/>
    </exec>
    <copy todir="${basedir}/build/test-results">
        <fileset dir="${basedir}/tests/js/jasmine-reporters/test">
            <include name="**/TEST*" />
        </fileset>