Skip to content

Instantly share code, notes, and snippets.

@timw4mail
timw4mail / build-php-ext.sh
Created September 9, 2019 19:22
PHP Extension source build boilerplate
#!/bin/sh
make clean; # For those rebuilds
phpize;
autoreconf --install --force; # Stupid autotools/libtool version incompatibilities
./configure;
make;
sudo make install;
@timw4mail
timw4mail / XML.php
Created December 12, 2018 20:43
XML Codec
<?php declare(strict_types=1);
/**
* XML <=> PHP Array codec
*/
final class XML {
/**
* XML representation of the data
*
@timw4mail
timw4mail / keybase.md
Created October 26, 2018 18:07
keybase.md

Keybase proof

I hereby claim:

  • I am timw4mail on github.
  • I am timw4mail (https://keybase.io/timw4mail) on keybase.
  • I have a public key ASC7SlmqpsRmOuaFxqzF6TVO8jxYqGE-wpkawVHCwgehHgo

To claim this, I am signing this object:

@timw4mail
timw4mail / update-mastodon.sh
Last active August 23, 2018 13:35
Script to update docker mastodon
#!/bin/bash
docker pull tootsuite/mastodon:latest;
docker-compose down;
docker-compose run --rm web bundle exec rake db:migrate;
docker-compose run --rm web bundle exec rake assets:precompile;
docker-compose up -d;
@timw4mail
timw4mail / emoji.php
Created December 27, 2016 19:15
Emoji in code
<?php
$animals = [
'dog' => '🐶',
'cat' => '🐱',
'mouse' => '🐭'
];
?>
<script>
let wildAnimals = {
@timw4mail
timw4mail / Javascript ES6|ES2015.md
Created October 26, 2016 13:54
Overview of useful new Javscript features

JavaScript ES6/ES2015

Block scope

  • let - assigns a new variable that can be overwritten with any type

  • const - assigns a new variable that can not be overwritten; however, non-scalar values can be modified (immutable variables, not really traditional constants)

Functions can also be block-scoped

<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
@timw4mail
timw4mail / ex16-extra-credit.c
Created February 4, 2015 21:34
Learn C the hard way
#include <stdio.h>
typedef struct {
char *name;
int age;
int height;
int weight;
} Person;
Person Person_create(char *name, int age, int height, int weight)
@timw4mail
timw4mail / .zshrc
Created October 29, 2014 20:02
zsh config
# correction
setopt correctall
#prompt
autoload -U promptinit
promptinit
prompt clint
@timw4mail
timw4mail / .osx
Created June 12, 2014 18:13
OS X dotfile
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Always show scrollbars