Skip to content

Instantly share code, notes, and snippets.


Manuel Strehl Boldewyn

View GitHub Profile
Boldewyn / install.php
Created September 13, 2021 11:42 — forked from tschoffelen/install.php
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
View install.php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('', file_get_contents(''));
$zip = new ZipArchive();
$res = $zip->open('');
if ($res === TRUE) {
Boldewyn / functions.php
Created July 7, 2020 14:31 — forked from sirbrillig/functions.php
Post file using wp_remote_post in WordPress
View functions.php
$local_file = 'file_path'; //path to a local file on your server
$post_fields = array(
'name' => 'value',
$boundary = wp_generate_password( 24 );
$headers = array(
'content-type' => 'multipart/form-data; boundary=' . $boundary,
Boldewyn /
Created June 16, 2017 22:26 — forked from szepeviktor/
Piwik automatic update - bash script
# Start this scipt above the /piwik directory.
# We assume that the webserver runs under www-data.
# download & verify
wget -nv "" || exit 1
wget -nv "" || exit 2
gpg --verify || exit 3
Boldewyn / post-merge
Created March 2, 2017 08:49 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#!/usr/bin/env bash
# MIT © Sindre Sorhus -
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
View ambient.js
var tessel = require('tessel');
var ambientlib = require('ambient-attx4');
var ambient = ambientlib.use(tessel.port['A']);
var rm = 40;
ambient.on('ready', function () {
// Get points of light and sound data.
var int = setInterval( function () {
ambient.getLightLevel( function(err, ldata) {
View search_unicode.bookmarklet.js
var x=''+(function(r){
var n=r.startContainer,
return 0xD800<=v&&v<=0xDB7F?((v&0x3FF)<<10|u.charCodeAt(1)&0x3FF)+0x10000:v;
View gist:8335997

Track deployments with Piwik's Annotation API

If you use analytics tools to monitor your website, a good metric for determining the effect of changes is the time of a deployment. Does the conversion rate really improve with the latest adjustments? Has the number of 404 errors decreased since we fixed that script?

Like other analytics products, Piwik allows you to annotate your data. Wouldn't it be great if all deployments were noted automatically? With the Annotation API it's actually quite simple.

In your deployment process, just add the following line to your script or post-receive hook and fill in the placeholders:

curl "http://YOUR_PIWIK_DOMAIN/?module=API&amp;\
View qsa-polyfill-ie7.js
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

View index.js
function(s,k){k=s.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);return new Date(Date.UTC(k[1],k[2]-1,k[3],k[4],k[5],k[6]))}