Skip to content

Instantly share code, notes, and snippets.

View jbrooksuk's full-sized avatar
🧑‍🚀

James Brooks jbrooksuk

🧑‍🚀
View GitHub Profile
<?php
private function loadQuotes() {
$this->comment('Loading quotes...');
$hFile = fopen($this->store . 'quotes.csv', 'r');
$progress = $this->getHelperSet()->get('progress');
$progress->setFormat($progress::FORMAT_VERBOSE_NOMAX);
$progress->start($this->getOutput());
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
@jbrooksuk
jbrooksuk / index.js
Last active August 29, 2015 14:06 — forked from andy-berry-dev/index.js
var https = require('https');
var Notification = require('node-notifier');
var CronJob = require('cron').CronJob;
var storesUrl = 'https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/stores.json';
var stockUrl = 'https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/availability.json';
var stockLastUpdated;
var stores;
{
"class": "icon_folder_dup",
"layer0.texture": "Theme - Default/icons/folder_dup.png",
"layer0.opacity": 1.0,
"content_margin": [8, 8]
}
@jbrooksuk
jbrooksuk / gist:de76b30d4c786d7f672d
Created January 21, 2015 10:00
git-verify-pack
This file has been truncated, but you can view the full file.
4d390885d709f97385ec581cf17c05852a3850d1 commit 400 267 12
486f8def9e531b3461b38292acc39e15db2dc077 commit 257 174 279
a7b22305c49c038b4ea791069d9dddbdd1f4842c commit 447 299 453
ebe2e27f9ddcb1d7cc7f94c4cf62219bb6dd51ac commit 442 298 752
1bf05c78baa46c8551e6899514f10916365db585 commit 545 355 1050
8f3f3792b039f2521af5389e5f5495bba1e790fe commit 301 206 1405
6a7a950042c0d4d3aed457671228898e782a5c6f commit 236 161 1611
7a7c98a05cbf6ea85fb9cd16eef0f74f41cfd091 commit 378 250 1772
a977d063a0335723d1a649bc0097bfade20f45ad commit 439 280 2022
82ea11bec90046e3f683dd648106794a60388b7f commit 692 433 2302
@jbrooksuk
jbrooksuk / jQuery Create Plugin
Created April 11, 2011 12:28
Creates DOM elements taking an element and a set of attribute properties
(function($) {
$.fn.create = function(el, attr) {
return jQuery(document.createElement(el)).attr(attr).prependTo(this);
}
})(jQuery);
@jbrooksuk
jbrooksuk / Raw HTML from element
Created April 12, 2011 08:05
Returns the raw HTML code for a supplied element.
(function($) {
$.fn.nodeHTML = function() {
return jQuery('<div>').append(jQuery(this).clone()).remove().contents().html();
};
})(jQuery);
@jbrooksuk
jbrooksuk / Sublime Text 2 PHP Build
Created April 12, 2011 08:34
Build file for PHP under Sublime Text Alpha 2
{
"cmd": ["php", "-l", "$file"],
"selector": "source.php",
"file_regex": "^Parse error: .* in (.*?) on line ([0-9]*)"
}
@jbrooksuk
jbrooksuk / gist:1004154
Created June 2, 2011 09:16
Table rows/cols selection
<!DOCTYPE html>
<html>
<head>
<title>jQuery RTE Dynamic Table Insertion Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style type="text/css">
.aBlock {
width: 20px;
height: 20px;
background-color: #A9EDF5;
@jbrooksuk
jbrooksuk / gist:1006285
Created June 3, 2011 12:53
jQuery Plugin to reverse $.each
jQuery.fn.reverse = [].reverse;