Skip to content

Instantly share code, notes, and snippets.


Jens Martsch jmartsch

View GitHub Profile
duncanmcclean / console.php
Last active Apr 16, 2021
Identify & fix Duplicate IDs in Statamic 3.
View console.php
<?php // copy everything after this line
Artisan::command('identify-duplicates', function () {
$duplicates = [];
$shouldFixDuplicates = $this->confirm('Should Duplicate IDs be replaced with fresh IDs?');
$items = collect(\Illuminate\Support\Facades\File::allFiles(__DIR__.'/../content'))
->filter(function ($file) {
return $file->isFile();
View scrollObserver
* ScrollMonitor
const scrollMonitorScript = {
cfg: {
selectors: {
waypoint: '[waypoint]',
waypointTarget: '[waypoint-target]',
nico-martin / gtag-gdpr-ready.html
Last active Feb 24, 2020
This little snippet provides a simple way to a) implement Google Tag Manager with anonymized IP and b) provide a Opt-Out / Opt-In mechanism: gtagOptOutIn();
View gtag-gdpr-ready.html
<script async src=""></script>
window.gtagTrackingID = 'UA-XXXXXXXX-X';
window.gtagDisableStr = 'gtag-disable-' + gtagTrackingID;
window.dataLayer = window.dataLayer || [];
function gtag() {
lokomotivan / fieldgroup.php
Last active Oct 10, 2019
Processwire Using API to create and manipulate pages, templates, field, users etc..
View fieldgroup.php
$fg = $this->fieldgroups->get('FIELDGROUP_NAME');
// if not, create it
if(empty($fg)) {
$fg = new Fieldgroup();
$fg->name = 'NAME';
Nilpo / Using Git to Manage a Live Web
Last active Jun 10, 2021
Using Git to Manage a Live Web Site
View Using Git to Manage a Live Web

Using Git to Manage a Live Web Site


As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.


View Project Questionnaire
Here are a few questions that will tee us up for a good conversation:
- Can you tell me about your project in a few sentences?
- What’s the timeframe? Does a certain event depend on this project launching?
- What are you looking for from us? Do you want us to design, build, and launch the whole site? Or do you have developers or other partners lined up and only need us for design?
- Have you already started on any part of the project? Do you have existing work? A new logo? Some rough designs or ideas for the site?
- How large is your team? What are the roles you envision on your end?
- How did you hear about our work? What specifically interests you about it? Any projects that you’re keen on?
- How much money have you set aside for this project?
- Are you talking to others about this project? Might we ask how many? What do you like about their work?
somatonic / form-process.php
Last active Nov 18, 2020
ProcessWire example front-end form with file upload and fields
View form-process.php
// ------------------------------ FORM Processing ---------------------------------------
$errors = null;
$success = false;
// helper function to format form errors
function showError($e){
return "<p class='error'>$e</p>";