Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
su - USERNAME -c "cd /Users/USERNAME/vosbox; rbfu vagrant suspend"
exit 0
@leostaples
leostaples / gist:4538869
Last active December 11, 2015 03:38
Xdebug set-up

Setting up Xdebug

1.) Modify Xdebug settings on sandbox

cd vosbox

vagrant ssh

nano /etc/php.d/xdebug_sandbox.ini
@leostaples
leostaples / gist:4730870
Last active December 12, 2015 06:39
CSS Style Guide

#CSS Style Guide

Here is what we'll cover:

  • Summary
  • Terminology
  • Style
  • Sass
  • Object-Oriented CSS (OOCSS) BEM
  • Abstractions?
@leostaples
leostaples / news-loader.js
Created March 15, 2013 11:52
news-loader
<script id="news-loader">
if ('querySelector' in document && 'localStorage' in window && 'addEventListener' in window) {
var curl = {
baseUrl: 'http://static.bbci.co.uk/news/1.5.4r3-30/js',
apiContext: window,
apiName: 'require',
overwriteApi: true,
paths: {
"jquery-1": "http:\/\/static.bbci.co.uk\/frameworks\/jquery\/0.2.1\/sharedmodules\/jquery-1.7.2",
"demi-1": "http:\/\/static.bbci.co.uk\/frameworks\/demi\/0.9.8\/sharedmodules\/demi-1",
@leostaples
leostaples / config
Created March 20, 2013 11:08
~/.ssh/config
ProxyCommand ~/.ssh/proxy %h %p
Host sandbox
Hostname 192.168.192.10
User root
#Host github.com
#ProxyCommand nc -x socks-gw.reith.bbc.co.uk:1085 %h %p
@leostaples
leostaples / proxy
Created March 20, 2013 11:08
~/.ssh/proxy
#!/bin/bash
NETWORK_LOCATION="$(/usr/sbin/scselect 2>&1 | egrep '^ \* ' | sed 's:.*(\(.*\)):\1:')"
if [ "$NETWORK_LOCATION" = "BBC On Network" ]; then
if [[ "$1" == "localhost" || "$1" == "127.0.0.1" || "$1" =~ "sandbox.dev.bbc.co.uk" ]]; then
/usr/local/bin/connect $1 $2
else
/usr/local/bin/connect -S socks-gw.reith.bbc.co.uk:1085 $1 $2
fi
@leostaples
leostaples / SourceTest.php
Created May 10, 2013 12:20
testRetrieveCorrespondentStories
public function testRetrieveCorrespondentStories()
{
$service = new BBC_News_Service_Candy_Source($this->client, $this->multiClient, new BBC_News_Service_Candy_Transformer(), $this->host);
$collection = $service->retrieveCorrespondentStories('nickrobinson');
$this->assertEquals(3, $collection->count());
}
@leostaples
leostaples / gist:5642615
Last active December 17, 2015 16:59
xpath
<body xmlns=\"http://www.bbc.co.uk/asset\">
<paragraph>1</paragraph>
<image id=\"63255201\"/>
<paragraph>2</paragraph>
<paragraph>3</paragraph>
<paragraph>4</paragraph>
<name>Mark Devenport</name>
<paragraph>5</paragraph>
<paragraph>6</paragraph>
<name>Nick Robinson</name>
@leostaples
leostaples / correspondents
Last active December 18, 2015 10:59
Correspondent List
Allegra Stratton
Andrew Harding
Andrew Neil
Andrew North
Arif Ansari
Betsan Powys
Brian Taylor
Chris Jackson
Damian Grammaticas
David Cornock
@leostaples
leostaples / gist:5821731
Last active December 18, 2015 17:49
Sublime Text - run rake task on save

###Run rake sass:compile:news when you save a .scss file

#####1.) Install https://github.com/alexnj/SublimeOnSaveBuild using Package Control

#####2.) Configure SublimeOnSaveBuild for your desired filetypes

Preferences > Package Settings > SublimeOnSaveBuild > Settings - User

{