Skip to content

Instantly share code, notes, and snippets.

View thinkbox's full-sized avatar

Jonno thinkbox

  • Brisbane, Australia
View GitHub Profile

Keybase proof

I hereby claim:

  • I am thinkbox on github.
  • I am thinkbox (https://keybase.io/thinkbox) on keybase.
  • I have a public key ASAWTjF7UCZI7owgpxkSlon60rMdKHwDiqZx8Pw2Nc66Pwo

To claim this, I am signing this object:

@thinkbox
thinkbox / gist:7d514232bb86136f71c8
Created March 12, 2016 17:01 — forked from MauMaGau/gist:2579601
PHP: video conversion script
<?php
// Run from the command line, so we'll grab arguments from there
// input arguments: 0=>script, 1=>file_name, 2=>temp_file
$file_name = $argv[1];
$temp_file = $argv[2];
$uploads = '/opt/lampp/htdocs/user_uploads/';
// Set up file location strings
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@thinkbox
thinkbox / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
mb_internal_encoding("UTF-8");
$yii = dirname(__FILE__) . '/../framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/console.php';
defined('YII_DEBUG') or define('YII_DEBUG', false);
require_once $yii;
<?php
include 'phpQuery-onefile.php';
$file = 'http://www.usbr.gov/lc/region/g4000/riverdata/gage-month-table.cfm?GAGE=3'; // see below for source
// loads the file
// basically think of your php script as a regular HTML page running client side with jQuery. This loads whatever file you want to be the current page
phpQuery::newDocumentFileHTML($file);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!--#START-ROOT-CODE
<?php
$docRoot = '/var/www/html';
require_once($docRoot .'/scripts/global-pre.php');
?>
#END-ROOT-CODE-->
<head>
@thinkbox
thinkbox / output.txt
Last active August 29, 2015 14:06 — forked from dtinth/output.txt
Array
(
[0] => Array
(
[index] => 1
[name] => BATT
[level] => Futurist
)
[1] => Array
#! /usr/bin/env php
<?php
/***
* PageSnap
*
* Script for archiving a HTML page (and associated media assets) into a single file.
*
* Requires:
*
<?php
// Include the phpQuery library
// Download at http://code.google.com/p/phpquery/
include 'phpQuery.php';
// Load Mike Fisher's player page on thescore.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.thescore.com/nhl/player_profiles/859-mike-fisher');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);