Skip to content

Instantly share code, notes, and snippets.

View arjenblokzijl's full-sized avatar

Arjen Blokzijl arjenblokzijl

View GitHub Profile
@arjenblokzijl
arjenblokzijl / gist:5622347
Created May 21, 2013 19:05
Fixed an unknown issue on a ProcessWire module. This gist is just temporary.
<?php
/**
*
* Multisite module for Processwire
* (C) 2012 Antti Peisa, Avoine Oy
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@arjenblokzijl
arjenblokzijl / gist:5656671
Last active December 17, 2015 18:58
Test for E-commerce plugin by apeisa
<?php
class ShoppingCheckout extends WireData implements Module, ConfigurableModule
{
public static function getModuleInfo()
{
return array(
'title' => 'Shopping Checkout',
'version' => 001,
'summary' => 'Handles checkout process, order saving etc. Main module for PW Shop',
<?php
// .... module
// create fields and templates using arrays
public function getTemplatesConfig() {
// title | field1 | field2 ...
$templatesArray = array(
'category' => array('title'),
@arjenblokzijl
arjenblokzijl / processwire-duplicate-role.php
Last active May 30, 2016 07:15
ProcessWire duplicate role with permissions and field access
<?php namespace ProcessWire;
include('index.php');
$contractingRole = wire('roles')->get('contracting-user');
$managerRole = wire('roles')->get('manager');
$managerRole->of(false);
$managerRole->permissions = $contractingRole->permissions;
$managerRole->save();
@arjenblokzijl
arjenblokzijl / process-module.php
Created July 12, 2016 09:19
Basic Process Module Process
<?php
class ProcessReleases extends Process implements Module {
public static function getModuleInfo() {
return array(
'title' => "Releases",
'version' => "0.0.1",
'summary' => "Show releases for the mydatafactory application.",
'autoload' => false,
@arjenblokzijl
arjenblokzijl / processWire-delete-unused-fields.php
Created August 19, 2016 09:17
ProcessWire delete unused Fields
<?php namespace ProcessWire;
include("../index.php");
foreach (wire('fields') as $f) {
if (count($f->getFieldgroups())) continue;
echo $f->name . "<hr>";
wire('fields')->delete($f);
}
@arjenblokzijl
arjenblokzijl / processwire-remove-system-flag-from-field.php
Last active April 20, 2017 02:22
ProcessWire remove system flag from field
<?php
$field = $fields->get("field_name_here"); // Insert system field i.e. roles
$field->flags = Field::flagSystemOverride;
$field->flags = 0;
$field->save();
@arjenblokzijl
arjenblokzijl / ssh-keys.md
Last active August 16, 2017 06:03
Setup SSH keys

SSH keys

1. Create

ssh-keygen -t rsa

2. Store the keys (and passphrase)

Once you have entered the Gen Key command, you will get a few more questions:

@arjenblokzijl
arjenblokzijl / useful-linux-shell-commands.md
Last active March 16, 2018 20:23
Useful Linux shell commands

Useful Linux shell commands

Move all folder content up one level

mv foo/* foo/.[^.]* . && rm -r foo/

@arjenblokzijl
arjenblokzijl / update-page-from-csv.php
Last active March 16, 2018 20:23
Update ProcessWire $page from CSV
<?php namespace ProcessWire;
include('index.php');
/**
* CSV format
*
* title,datetime_matching_date,page_matching_person
* 464,12/24/2014,1132
* 1750,5/9/2016,1132