Skip to content

Instantly share code, notes, and snippets.

View jonsherrard's full-sized avatar
💭
Working

Jon Sherrard jonsherrard

💭
Working
View GitHub Profile
This file has been truncated, but you can view the full file.
{"status":"ok","count":1249,"count_total":1249,"pages":1,"posts":[{"id":14989,"type":"map","slug":"the-avalon","url":"http:\/\/emeraldstreet.lab.shortlistmedia.co.uk\/map\/the-avalon","status":"publish","title":"The Avalon","title_plain":"The Avalon","content":"<p class=\"p1\"><span class=\"s1\">The huge dining room at this friendly gastropub is bested by the equally huge back terrace, with its separate spots for drinking, dining and letting the little ones run free \u2013 visit soon before summertime disappears fully. A popular place with a pleasant, suburban feel (read: big portions, families, no central London rushing), Sunday roasts give way to midweek burgers and pints. The starters shine: smoked trout rillettes with dill deftness; blackened red mullet with a generous tapenade-meets-gazpacho dressing. Big flavour hits and a good, inexpensive wine list make this perfect for large groups or a casual couples\u2019 night out.<\/span><\/p>\n","excerpt":"<p>The huge dining room at this friendly gastropub is b
@jonsherrard
jonsherrard / component.js
Created September 23, 2015 12:03
An example ES6 React component
import React, { Component } from 'react'
export default class MyComponent extends Component {
render() {
return (
<div>
<h1>This is my Component</h1>
</div>
)
}

Choosing a new GitHub organisation name

Needs:

  • Short
  • Easy to say
  • Not be taken
  • Sound "cool" / Could be a team name

Options:

@jonsherrard
jonsherrard / MY_Controller.php
Created April 25, 2012 14:51
CodeIgniter MY_Controller template. Requires ion_auth spark. Redirects user if not logged in. Stores the user's previous page in session data.
<?php
class MY_Controller extends CI_Controller {
function __construct () {
parent::__construct();
if (!$this->ion_auth->logged_in())
@jonsherrard
jonsherrard / PHP_Sanitize.php
Created April 25, 2012 14:54
Clean any string to make it URL friendly. Removes characters and whitespace
<?php
function sanitize($string, $force_lowercase = true, $anal = false) {
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]",
"}", "\\", "|", ";", ":", "\"", "'", "&#8216;", "&#8217;", "&#8220;", "&#8221;", "&#8211;", "&#8212;",
"—", "–", ",", "<", ".", ">", "/", "?");
$clean = trim(str_replace($strip, "", strip_tags($string)));
$clean = preg_replace('/\s+/', "-", $clean);
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;
return ($force_lowercase) ?
@jonsherrard
jonsherrard / String_Generator.php
Created April 25, 2012 14:59
Random string generator a-la imgur urls etc.
<?php
function generate_string($length) {
$chars = "0123456789abcdefghijklmnopqrstuvwxyz";
$string = "";
for ($i = 0; $i < $length; $i++) {
$string .= $chars[mt_rand(0, strlen($chars) - 1)];
}
@jonsherrard
jonsherrard / salusbury_email_1.html
Created May 18, 2012 12:29
salusbury_email_1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Facebook sharing information tags -->
<meta property="og:title" content="*|MC:SUBJECT|*" />
<title>Salusbury Rooms Newsletter #1</title>
<style type="text/css">
@jonsherrard
jonsherrard / .bash_profile
Created July 30, 2012 00:05
.bash_profile
## ALIASES
alias home='cd ~/'
alias ls='ls -ls -G'
alias webfaction='ssh web***.webfaction.com -l ************'
alias htdocs='cd /Applications/MAMP/htdocs'
##
CDPATH='.:~:/Applications/MAMP/htdocs'
@jonsherrard
jonsherrard / hosts
Created July 30, 2012 00:35
Hosts File
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@jonsherrard
jonsherrard / jsx-style.jsx
Last active October 8, 2015 15:20
How do you format your component props?
// 1
<Modal
isOpen={this.state.showTermsModal}
onRequestClose={this._toggleTerms}
style={this._customStyles}
/>
// 2