Skip to content

Instantly share code, notes, and snippets.

@dstollie
dstollie / script.js
Created October 21, 2019 16:38
Favro Bulk Restore User Script
// ==UserScript==
// @name Favro Bulk Restore
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://favro.com/*
// @grant unsafeWindow
// ==/UserScript==
@dstollie
dstollie / .phpcs_dist
Last active April 5, 2017 23:02
PHP CS Fixer for the win
<?php
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@PHP70Migration' => true,
/*
* Enforce some structure!
*/
@dstollie
dstollie / .phpcs_dist
Created April 5, 2017 22:49
PHP CS Fixer for the win
<?php
$finder = PhpCsFixer\Finder::create();
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@PHP70Migration' => true,
@dstollie
dstollie / samenzwolle-create-activity.php
Last active May 26, 2016 15:24
SamenZwolle.nl activiteit aanmaken PHP voorbeeld
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$appUrl = 'http://samenzwolle.bijna.live/api/activities';
$apiKey = '$2y$10$WaWaK1rIVzjiIYh4gkbl.uexHS8dMNBSfcPOO1l3/9k8V4xnQUwBi';
$body = "{\"name\":\"Voorbeeld activiteit\",\"description\":\"Dit is een omschrijving\",\"start_date\":[\"09-05-2016 00:00\",\"11-05-2016 00:00\"],\"end_date\":[\"10-05-2016 00:00\",\"12-05-2016 00:00\"],\"url_email\":\"https://example.com/activities/1\",\"street\":\"Wilhelm Rontgenstraat\",\"house_number\":\"11B\",\"zipcode\":\"8013NE\",\"postbox\":\"-\",\"image1\":\"http://lorempixel.com/400/200/\",\"image2\":\"http://lorempixel.com/400/200/\",\"image3\":\"http://lorempixel.com/400/200/\",\"agreement\":\"1\"}";
$curl = curl_init();
@dstollie
dstollie / reinit-git-repository.sh
Last active December 9, 2015 21:10
Remove all commits to reset a remote GIT repository
#!/bin/sh
#
# 1. Delete the .git directory locally.
# 2. Recreate the git repostory:
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
@dstollie
dstollie / 0_reuse_code.js
Created December 8, 2015 01:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dstollie
dstollie / MyModel.php
Created November 11, 2015 13:54
Wordpress Snippet: Simple snippet to get the following, previous and related posts of a post of a certain post type
<?php
/**
* returns a WP_Query instance which generates a list of news items which have the same theme taxonomy as the given post.
* If not post is given the global post will be used
*
* @param null $postId
* @param [] $query
*
* @return WP_Query
*/
@dstollie
dstollie / acf.php
Last active September 15, 2017 14:13
Using Themosis templates in ACF
<?php
/**
* ACF has this fancy option to show ACF fields based on pages templates.
* One problem: Themosis templates are not registered as "default" WordPress templates.
* This file hooks into the acf filters and allows ACF to use the Themosis templates.
*/
// add themosis templates
add_filter('acf/location/rule_values/page_template', 'add_themosis_templates_to_acf_rules');
function add_themosis_templates_to_acf_rules($choices)
@dstollie
dstollie / .env.local.php.dist
Created October 12, 2015 23:20
Example of adding Twig support to the composer-dist-installer package
<?php
/*----------------------------------------------------*/
// Local environment vars
/*----------------------------------------------------*/
{% set db_name = '{!Database name?[]?|wordpress!}' %}
{% set db_user = '{!Database user []?|=ENV[USER]!}' %}
{% set db_password = '{!Database password?!}' %}
{% set db_host = '{!Database host []?|localhost!}' %}
{% set db_home = '{!Wordpress home url []?|http://mysite.dev/!}' %}
{% set db_siteurl = '{!Wordpress site url []?|http://mysite.dev/cms/!}' %}
AnswerSchema = new SimpleSchema(_.extend({
body: {
type: String
},
questionId: {
type: String
},
upvotes: {
type: Number,
optional: true,