Skip to content

Instantly share code, notes, and snippets.

View borkweb's full-sized avatar

Matthew Batchelder borkweb

View GitHub Profile
<?php
$loops = 1000000;
$a = array();
$b = array();
for ($i = 0; $i < $loops; $i++) {
$a[] = $i;
$b["item{$i}"] = $i;
}
// ==UserScript==
// @name Modern Tribe navigation
// @namespace central.tri.be
// @version 0.1
// @description Adds custom navigation to GitHub and Central
// @author Matthew Batchelder
// @match https://github.com
// @include /^https:\/\/github.com\/.*/
// @include /^https:\/\/central.tri.be(\/.*)?/
// @grant none
<?php
function absint( $maybeint ) {
return abs( intval( $maybeint ) );
}
function sanitize_absint( $number = null ){
// If it's not numeric we forget about it
if ( ! is_numeric( $number ) ){
return false;
}
@borkweb
borkweb / mtup
Last active August 29, 2015 14:21
#!/bin/bash
#########################
# This bash script pulls the latest plugin code for whichever branch is checked out
#
# Optionally checks out a branch before pulling.
#
# Example: mtup develop
#########################
// Calculate hours for any type of ticket in the next release
(function( $ ) {
var total = 0;
$('.estimated_hours').each(function() {
var $el = $( this );
var $row = $el.closest( 'tr' );
var $version = $row.find( '.fixed_version a' );
if ( 'Next Release' !== $.trim( $version.html() ) ) return;
<?php
function convert_recurring_event_meta() {
global $wpdb;
// Get meta values
$event_recurrence_meta = $wpdb->get_results("
SELECT post_id, meta_value
FROM $wpdb->postmeta
WHERE meta_key = '_EventRecurrence'
@borkweb
borkweb / template:!
Created October 6, 2018 04:55
Template:!
|
@borkweb
borkweb / Template:Clear
Created October 6, 2018 04:57
(MediaWiki) Template:Clear
<div style="clear:both"></div>
@borkweb
borkweb / Template:Area
Created October 6, 2018 04:59
(MediaWiki) Template:Area
{| width="250" align="right" class="info-box area"
|-
{{#if: {{{image|}}}|
{{!}} colspan="2" class="info-image" {{!}} {{{image}}}}}
|-
| colspan="2" class="info-name" | '''{{{name}}}'''
|-
| colspan="2" class="info" | '''General Information'''
|-