Skip to content

Instantly share code, notes, and snippets.

View datakurre's full-sized avatar

Asko Soukka datakurre

View GitHub Profile
@datakurre
datakurre / default.nix
Last active January 13, 2016 12:49
Failing Selenium test
with import <nixpkgs> { };
let dependencies = rec {
selenium = pythonPackages.selenium.overrideDerivation (args: rec {
version = "2.48.0";
name = "selenium-${version}";
src = fetchurl {
url = "https://pypi.python.org/packages/source/s/selenium/selenium-${version}.tar.gz";
sha256 = "1n0rp6g97rg4154a48yg69vm3f4qybqwz6kqxj1xq5akjm3agp6m";
};
patches = [
include VERSION *.py *.rst *.nix
exclude .* Makefile test_example.py
@datakurre
datakurre / LicenseSelector.elm
Last active May 12, 2016 11:03
Creative Commons license chooser widget in Elm
port module LicenseSelector exposing (..)
import Html exposing (Html, button, div, img, input, label, p, text)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onCheck)
import String
main =
@datakurre
datakurre / configuration.nix
Last active October 14, 2024 07:25
Bootable NixOS USB stick for kiosk or demo usage
{ config, lib, pkgs, ... }:
with lib;
{
imports = [
# ISO image
<nixpkgs/nixos/modules/installer/cd-dvd/iso-image.nix>
# Hardware support similar to installer Live CD
<nixpkgs/nixos/modules/profiles/all-hardware.nix>
@datakurre
datakurre / default.js
Last active September 29, 2016 18:23
Shimming collective.polls for webpack...
// collective.z3cform.widgets
import 'imports?jQuery=jquery!++resource++collective.z3cform.widgets/jquery.tasksplease';
// collective.z3cform.widgets replaces keyword / categorization widget also on Plone 5...
import 'imports?jQuery=jquery!++resource++collective.z3cform.widgets/jquery.tokeninput';
import keywordTokenInputActivate from 'imports?$=jquery,jQuery=jquery!exports?keywordTokenInputActivate!++resource++collective.z3cform.widgets/keywords';
window.keywordTokenInputActivate = keywordTokenInputActivate;
// collective.polls
import 'jquery.browser'; // jquery.browser is no more in jQuery >= 1.9
@datakurre
datakurre / registry.xml
Last active July 6, 2017 15:24
Enabling template plugin in Plone Mosaic
<?xml version="1.0"?>
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<record name="plone.custom_plugins" interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema">
<value>
<element>template|++plone++static/components/tinymce-builded/js/tinymce/plugins/template/plugin</element>
</value>
</record>
@datakurre
datakurre / registry.xml
Created July 6, 2017 15:42
Rich text tiles with templates in Plone Mosaic
<?xml version="1.0"?>
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<records prefix="plone.app.mosaic.structure_tiles.card"
interface="plone.app.mosaic.interfaces.ITile">
<value key="default_value">&lt;div class="card-header"&gt;Header&lt;/div&gt;&lt;div class="card card-block"&gt;&lt;h3 class="card-title"&gt;TItle 1&lt;/h3&gt;&lt;p class="card-text"&gt;Content&lt;/p&gt;&lt;/div&gt;</value>
<value key="category">structure</value>
<value key="read_only">False</value>
<value key="name">card</value>
@datakurre
datakurre / parse.py
Created September 10, 2017 19:38
Parsing naive install_requires with AST
import ast
tree = ast.parse(open('setup.py').read())
names = {}
def strings(tree):
ret = []
for node in ast.walk(tree):
if isinstance(node, ast.Name):
@datakurre
datakurre / default.nix
Last active December 18, 2017 10:36
nix-shell for Plone buildout with Selenium tests
#!/usr/bin/env nix-shell
{ rev ? "beb1f1ea91ef15d5f1b272108b0cf964e47665f2"
, sha256 ? "02n73jmc0vbb2dq5af70zxms63jbgbnzc70fmw50mcq07fpwa3p9"
, pkgs ? import ((import <nixpkgs> {}).pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
inherit rev;
inherit sha256;
}) {}
, pythonPackages ? pkgs.python27Packages
@datakurre
datakurre / fragment.pt
Last active October 20, 2017 11:14
Tile with a single RichText field in Plone Mosaic with collective.themefragments
<tal:block define="value nocall:view/data/html|nothing;
output_relative_to nocall:value/@@output_relative_to|nothing"
condition="output_relative_to"
content="structure python:output_relative_to(context)" />