Skip to content

Instantly share code, notes, and snippets.

View alexbilbie's full-sized avatar
👋

Alex Bilbie alexbilbie

👋
View GitHub Profile
@alexbilbie
alexbilbie / ms.less
Created July 1, 2012 18:45
Modular size typography
/* Modular Size typography */
@base-font-size: 14; // this is the base f
@important-font-size: 44;
@font-ratio: 1.618;
@base-diff: @important-font-size / @base-font-size;
@h1: @important-font-size;
@h2: (@base-diff / (@base-diff - (@base-diff / @font-ratio)));
@alexbilbie
alexbilbie / gist:3104893
Created July 13, 2012 13:30
Byword broken code parser
* test list
* test list
* test list
code block which won't work
foo bar foo bar foo bar foo
* test list
* test list
* test list
@alexbilbie
alexbilbie / gist:3169400
Created July 24, 2012 11:02
Food you should always have in

Basics

  • Tin/carton chopped tomatoes
  • Tube of tomato puree
  • White onions
  • Red onions
  • Garlic
  • New potatoes
  • Easy cook rice
  • Risotto rice
@alexbilbie
alexbilbie / gist:3193757
Created July 28, 2012 15:34
PHP Hubot script
#!/usr/bin/php
<?php
$vars = explode(' ', $argv[1]);
if ($vars[0] === 'hello')
{
echo 'Hello, ' . $vars[1] . '. How are you?' . PHP_EOL;
}
@alexbilbie
alexbilbie / gist:3215872
Created July 31, 2012 10:21
Hubot phone search
#!/usr/bin/php
<?php
$vars = explode(' ', $argv[1]);
if ($vars[0] === 'phone')
{
unset($vars[0]); // remove the "phone" bit
$search = implode(' ', $vars);
@alexbilbie
alexbilbie / gist:3609857
Created September 3, 2012 14:52
Protect identifiers test
<?php
class db {
var $_protect_identifiers = FALSE;
var $_reserved_identifiers = array('*');
var $_escape_char = '`';
var $qb_aliased_tables = array();
public function escape_identifiers($item)
@alexbilbie
alexbilbie / gist:3691756
Created September 10, 2012 16:02
CodeIgniter OAuth controller example
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Oauth extends CI_Controller {
private $oauth;
public function __construct()
{
parent::__construct();
@alexbilbie
alexbilbie / rss-subscribers.sh
Created September 27, 2012 19:36
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/var/log/httpd/access_log"
@alexbilbie
alexbilbie / composer.json
Created October 14, 2012 16:16
OAuth2 client example
{
"require": {
"lncd/oauth2-facebook": "*",
"slim/slim": "2.*"
},
"minimum-stability": "dev"
}
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<name>Transport for London Stations facilities</name>
<open>0</open>
<description>Transport for London Stations facilities</description>
<Header>
<Identifier>TfL | Station information</Identifier>
<DisplayTitle>TfL | Station information</DisplayTitle>
<Version>1.0</Version>
<PublishDateTime canonical="2010-02-04 11:54:08:000">Thu, 04 Feb 2010 11:54:08 +0100</PublishDateTime>