View http.go
1 2 3 4 5 6 7 8 9 10
package utils
 
import (
"encoding/base64"
"net/http"
"strings"
)
 
func BasicAuth(handler http.HandlerFunc, username, password string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
View branch-be-gone.php
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env php
<?php
`git fetch -p --all`;
$branches = `git branch -vv`;
preg_match_all('%^\ +(?P<branch>[\w/=\-.#]+)\ +(?P<hash>[0-9a-fA-F]+)\ \[[\w/=\-.#]+:\sgone\]%smx', $branches, $result, PREG_PATTERN_ORDER);
foreach( $result['branch'] as $index => $branch ) {
$output = [ ];
View QuerySampler.php
1 2 3 4 5 6 7 8 9 10
<?php
$timeout = 1800; //seconds
$sleep = 100000; //microseconds
$start = time();
$link = mysql_connect('[[HOST]]', '[[USERNAME]]', '[[PASSWORD]]');
if( !$link ) {
die('Could not connect: ' . mysql_error());
}
View join2insert.php
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env php
<?php
$string = "";
while( $line = fgets(STDIN) ) {
$string .= $line;
}
$string = strtolower($string);
View ordmaker.php
1 2 3 4 5 6 7 8 9 10
#! /usr/bin/env php
<?php
$data = $argv[1];
$split = str_split($data);
foreach($split as $ord) {
echo "\\x" . dechex(ord($ord));
}
View arrays_are_similar.php
1 2 3 4 5 6 7 8 9 10
<?php
function arrays_are_similar( $aSide, $bSide ) {
$keys = array_unique(array_merge(
array_keys($aSide),
array_keys($bSide)
));
foreach( $keys as $key ) {
View _ScaledSpriteMap.scss
1 2 3 4 5 6 7 8 9 10
@mixin scaled-sprite-background($name, $scale, $spritemap) {
background: $spritemap;
 
$spritePath: sprite-path($spritemap);
@include background-size(image-width($spritePath) * $scale);
 
$position: sprite-position($spritemap, $name);
background-position: (nth($position, 1) * $scale) (nth($position, 2) * $scale);
height: image-height(sprite-file($spritemap, $name)) * $scale;
View getinfo.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
# Requires a POSIX-ish shell.
 
#
# Originally From: http://hayne.net/MacDev/Bash/show_getinfo
#
 
# show_getinfo
# This script opens the Finder's "Get Info" window
# for the file or folder specified as a command-line argument.
View index.php
1 2 3 4 5 6 7 8 9 10
<?php
date_default_timezone_set('America/Chicago');
$subject = file_get_contents("http://penny-arcade.com/dlc");
preg_match_all('%<li[ >].*?<h4>(?P<title>.*?)</h4>.*?class="paDLCLink"[^>]href="(?P<file>.*?)".*?</li%si', $subject, $result, PREG_SET_ORDER);
header('Content-Type: application/rss+xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
View a_gearnan.log
1 2 3 4 5 6 7 8 9 10
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by gearmand configure 1.1.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
 
$ ./configure --prefix=/usr/local/Cellar/gearman/1.1.7 --with-mysql
 
## --------- ##
## Platform. ##
Something went wrong with that request. Please try again.