Skip to content

Instantly share code, notes, and snippets.

Avatar
🤡

Simon Bowen simonbowen

🤡
View GitHub Profile
View gist:a8316fe91c78b8464402
# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 5.5.38-0ubuntu0.14.04.1)
# Database: CampaignText
# Generation Time: 2015-01-28 10:44:05 +0000
@simonbowen
simonbowen / xmpp.py
Created Sep 29, 2013
SleekXMPP and gevent
View xmpp.py
import sleekxmpp
import gevent
import sqlite3
class Message(sleekxmpp.ClientXMPP):
def __init__(self, jid, password):
super(Message, self).__init__(jid, password)
self.add_event_handler('session_start', self.start)
View gist:6229731
$(function(){
var products = [
{name: 'iPad', description: 'iPad', price: 300, applecare: 50, insurance: 60},
{name: 'ipad2', description: 'ipad2', price: 350, applecare: 55, insurance: 65}
];
// Then build the table from the Javascript array/object
var table = $('table');
for(x=0; x<products.length; x++){
var tr = $('<tr>');
View gist:5494836
php_flag display_errors on
php_flag display_startup_errors on
php_value error_reporting 2047
php_value upload_max_filesize 20M
php_value post_max_size 20M
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/var/www/vhosts/myfonedev.co.uk/.htpasswds/.htpasswd"
require valid-user
View Writer.php
public function format_message(array $message, $format = "time --- level: body in file:line")
{
$message['time'] = Date::formatted_time('@'.$message['time'], Log_Writer::$timestamp, Log_Writer::$timezone, TRUE);
$message['level'] = $this->_log_levels[$message['level']];
$string = strtr($format, array_filter($message, 'is_scalar'));
if (isset($message['additional']['exception']))
{
// Re-use as much as possible, just resetting the body to the trace
@simonbowen
simonbowen / gist:5160750
Created Mar 14, 2013
Why Shopify Is Bad
View gist:5160750

Documentation

The documentation for shopify is horrendous, there are filters and various other undocumented features that I found in the Liquid template documentation.

Hard to find out how to customise certain areas of the shopify front end. Such as the customer login areas.

Check out Process

This is the worst part, you cannot specify your own HTML for ANY of the checkout pages. You have to rely on CSS to try and style these pages. What makes it even more of a headache is Shopify only gives you terrible markup, nasty use of tables, ID's and classes through out.

View gist:4772060
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
View child.html
{% extends "parent.html" %}
{% block title %}Child Template{% endblock %}
{% block container %}Some page content{% endblock %}
@simonbowen
simonbowen / example_checkboxselectmultiple_render.py
Last active Dec 12, 2015
How to customise output of the CheckboxSelectMultiple in Django. I was being a pleb and didn't quite get it at first
View example_checkboxselectmultiple_render.py
### Form, I was originally using a ModelForm, so that's what I shall demonstrate here
class Author(models.Model):
books = models.ManyToManyField(Book)
class AuthorForm(forms.ModelForm):
class Meta:
model = Author
def __init__(self, *args, **kwargs):
@simonbowen
simonbowen / text.php
Created Apr 27, 2011
Auto Link Twitter Replies Kohana 3.x
View text.php
<?php defined('SYSPATH') or die('No direct script access.');
class Text extends Kohana_Text {
public static function auto_twitter($text)
{
return preg_replace('#@([\\d\\w]+)#', '<a href="http://twitter.com/$1">$0</a>', $text);
}
}