Skip to content

Instantly share code, notes, and snippets.

View spoetnik's full-sized avatar

Martijn de Geus spoetnik

  • The Hague, the Netherlands
View GitHub Profile
@nrrb
nrrb / selenium_basics.py
Created April 16, 2012 22:18
Selenium stuffs
from selenium import webdriver
profile = webdriver.FirefoxProfile()
# Set proxy settings to manual
profile.set_preference('network.proxy.type', 1)
# Set proxy to Tor client on localhost
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
# Disable all images from loading, speeds page loading
# http://kb.mozillazine.org/Permissions.default.image
@somatonic
somatonic / from.php
Last active June 26, 2018 19:23
Create a page edit form on frontend using PW API and fields from the template of the page
<?php
// get a page
$editpage = $pages->get("/editme/");
$ignorefields = array("isOld","language_published");
$form = $modules->get("InputfieldForm");
$form->method = 'post';
$form->action = './';
@jacmaes
jacmaes / form.php
Last active July 12, 2023 07:58 — forked from somatonic/inputfieldfile-form.php
Processwire: Front-end upload form example using ProcessWire Inputfields #pw
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
@stevelacey
stevelacey / middleware.py
Last active May 10, 2024 15:05 — forked from mindlace/middleware.py
UserstampMiddleware
# -*- coding: utf-8 -*-
from django.db.models import signals
from django.utils.functional import curry
from rest_framework import authentication
class UserstampMiddleware(object):
"""Add user created_by and updated_by foreign key refs to any model automatically.
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py"""
def process_request(self, request):
@bdno86
bdno86 / camphor.scss
Last active June 22, 2024 13:27
camphor
$camphor300:'d09GMgABAAAAAQ5UABIAAAAEn0QAAQ3tAAEZmQAAAAAAAAAAAAAAAAAAAAAAAAAAG4SkahzOKgZgFotgAIosCCIJgnMRCAqLlgCKvTwBNgIkA5lwE4GnDguZdAAEIAW7bwcgDHJb0WS0WUXZkokWaBHx4wKbY7TigANIU/t980QCGzI/IkCsdbqJZwY1ZOgWDngIamw3I43435Dd+zJ1kNmKVp/DvXNAwaNm//////////////////+/NZkMZ5cAl0CpbZ3oiwloFA5GyIWNzOYVLt1bpXPX+pABI2fo5rMZpgVYIzYqgxt92ajECqUKh2G9gaOCVRC23VSRVypHfbvb7wYcwEM25WArF0esm1yKzDixrJRdcBGtcpBZTFbFbIl8LIU4gWOnEdSITqkoGrHWJ8ywn9eVFWWk3lC6m07qp1TXntHaWp6ekYHLrFoyzOXYiQnn2kWX2zqMaFBTca25vHKndPhJV66HRhQzL9lB3OT20KGTXuFHu62wm1qzoV/iTnaiLdc8o/D7B+1O94BrjSE3cia6U1A5XNp0kHmUj8IMBaeiGaiNJV7b1csb0bq8EWYo2h1TuipR+7hmYjxeZsonGLNcmgsKp5EUDCEj9SvRyxX2uMUNfINmfNqglBYNNtjtNmdwWV2ly4uQKheyDyka2RTRoQ3IEfs+0BNcGJ4Z5AnmHNpFbCKW5PsXkAzJ6VVzzVMo0fwIUpQQT67itTNRE946/NxDashl9KuAFUbZ6yW91vObh+WAMZ1mQ1J4wotF6KXHuo65X6wSz406hW/T6XZMf/6W+HGYUxCDfhyjPaoMGcWccmbYM/H35NdHTOd79Jg0ho/BDBvRy2vcg8pHsv07UYiKrDFeqzL0Qk7qCkXLuukl2EKuR3xS6VtsLEaT0BfWoDYoQ1YvEjjT729XNMYoCX3j+2ApedBG/UHLOJ7AAnfPSqdmmePsY+522MpfPaf7kf6fIJMn0/4SE6PmuI3yjyeGjWn+1qj/ukf09DE
@tonithenhausen
tonithenhausen / offline_v5.xml
Last active May 28, 2024 05:31
Karoo Rendertheme
<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#dcd5d0"
map-background-outside="#dcd5d0" version="5" xmlns="http://mapsforge.org/renderTheme"
xsi:schemaLocation="http://mapsforge.org/renderTheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
<!-- AREA STYLES -->
<style-area fill="#6e91cd" id="water" mesh="true"/>
<!-- LINE CASINGS -->
<style-line id="unpaved_casing" stroke="#669e844c" stroke-linecap="round"/>
@kongondo
kongondo / UpdateProcessWireFrontendContentUsingHtmxDemo.js
Last active August 11, 2023 11:47
Using htmx to Refresh ProcessWire Frontend Content
const UpdateProcessWireFrontendContentUsingHtmxDemo = {
initHTMXXRequestedWithXMLHttpRequest: function () {
document.body.addEventListener("htmx:configRequest", (event) => {
// @note: ADD THIS!!! if not using hx-include='token input'
// const csrf_token = UpdateProcessWireFrontendContentUsingHtmxDemo.getCSRFToken()
// event.detail.headers[csrf_token.name] = csrf_token.value
// add XMLHttpRequest to header to work with $config->ajax
event.detail.headers["X-Requested-With"] = "XMLHttpRequest"
})
},