Skip to content

Instantly share code, notes, and snippets.

Timothy Warren timw4mail

Block or report user

Report or block timw4mail

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timw4mail
timw4mail / optimize-images.sh
Last active Jan 24, 2020
Image Optimization script
View optimize-images.sh
#!/usr/bin/env bash
set -euo pipefail
declare threads=`getconf _NPROCESSORS_ONLN`
optimise () {
declare -a exts=("${!1}")
declare msg=$2
for ext in ${exts[@]}
View emoji-functions.php
<?php declare(strict_types=1);
function createDataObject (int $min, int $max, array $blacklist = []): array
{
$output = [];
$index = 0;
for ($i = $min; $i <= $max; $i++)
{
$n = base_convert((string)$i, 10, 16);
@timw4mail
timw4mail / build-php-ext.sh
Created Sep 9, 2019
PHP Extension source build boilerplate
View build-php-ext.sh
#!/bin/sh
make clean; # For those rebuilds
phpize;
autoreconf --install --force; # Stupid autotools/libtool version incompatibilities
./configure;
make;
sudo make install;
View XML.php
<?php declare(strict_types=1);
/**
* XML <=> PHP Array codec
*/
final class XML {
/**
* XML representation of the data
*
View 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 Aug 23, 2018
Script to update docker mastodon
View update-mastodon.sh
#!/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;
View emoji.php
<?php
$animals = [
'dog' => '🐶',
'cat' => '🐱',
'mouse' => '🐭'
];
?>
<script>
let wildAnimals = {
@timw4mail
timw4mail / Javascript ES6|ES2015.md
Created Oct 26, 2016
Overview of useful new Javscript features
View Javascript ES6|ES2015.md

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

View .htaccess
<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
View ex16-extra-credit.c
#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)
You can’t perform that action at this time.