Skip to content

Instantly share code, notes, and snippets.

View tomjn's full-sized avatar
🎯
Focusing

Tom J Nowell tomjn

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Takes a composer controlled repo and pushes a
# composed PACKAGE into a branch called "PACKAGE".
(
# SANITY CHECKS
# Check for uncommitted changes, and refuse to proceed if there are any
if [ -n "$(git ls-files . --exclude-standard --others)" ]; then
@philipjohn
philipjohn / ascii-for-the-people
Last active August 29, 2015 14:02
ASCII For The People
/* Copyright 2014 Code for the People Ltd
_____________
/ ____ \
_____/ \ \ \
/\ \ \___\ \
/ \ \ \
/ / / _______\
/ / / \ /
/ / / \ /
#!/usr/bin/env sh
##
# Make your Mac feel like home...
# Shoutout to @dtsn for being generally awesome and getting me started.
#
# install it:
# curl -sL https://gist.github.com/BenNunney/7219538/raw/f9b933cca93b67dd63a2d8b1eeebb69e87dc9591/feels-like-home.sh | sh
#
@franz-josef-kaiser
franz-josef-kaiser / wpse.md
Created October 18, 2012 17:16
Comments for WPSE
@Rarst
Rarst / a-fresher-cache.php
Last active December 16, 2015 22:09
Additional items for A Fresher Cache WP plugin: APC, plugin/themes updates.
<?php
add_action( 'init', function () {
if ( ! function_exists( 'afc_add_item' ) || ! function_exists( 'apc_clear_cache' ) ) {
return;
}
afc_add_item( array(
'id' => 'apc',
<?php
$pages = new query_loop( array(
'post_type' => 'page'
));
foreach( $pages as $id => $post ) {
the_title();
// etc...
}
@Rarst
Rarst / readme.md
Last active December 24, 2015 22:09
Bolt on of whoops to WordPress, rough, proper plugin some time later
@bradphelan
bradphelan / SmallestAngleBetweenTestSuite.cs
Last active March 9, 2016 14:17
Test suite for smallest angle between in C#
[Fact]
public void SmallestSignedAngleBetweenShouldWork ()
{
WMath.SmallestSignedAngleBetween(0.1, 0.2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1, 0.2+Math.PI*2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1, 0.2-Math.PI*2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1+Math.PI*2, 0.2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1-Math.PI*2, 0.2).Should().BeApproximately(0.1, 1e-5);
@tomjn
tomjn / readme.md
Last active March 19, 2016 00:38
Copy paste into the terminal on OS X to download and install everything needed for VVV, then create a VVV vagrant box in ~/vvv

Open the "Terminal" application in MacOS X, then copy paste the script and press enter. It will install VVV and all its dependencies.

It will also install an additional site that will show how to add your own sites ( site-name.dev ).

When finished, it will do several things:

  • Open your www folder in Finder for editing
  • Open the VVV webpage for information
  • Open the CFTP Site init scaffold with information on how to add your own sites
@thefuxia
thefuxia / t5-silent-flush.php
Last active August 11, 2016 11:03
T5 Silent Flush - Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Silent Flush
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
* Version: 2013.05.04
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/