Skip to content

Instantly share code, notes, and snippets.

View matherton's full-sized avatar

Mark Atherton matherton

View GitHub Profile
@matherton
matherton / Update Eventbrite form
Created September 23, 2011 10:20
Simple Eventbrite create venue and event form
<html>
<head>
<title>Event creation form</title>
</head>
<!-- All strings - These are mandatory fields title, start_date, end_date, timezone. The description is optional but guess we would require -->
<body>
<!-- A form to create an event and passes it's variables to event_creator.php -->
<form method="post" action="event_creator.php">
<fieldset>
@matherton
matherton / create new event script
Created September 27, 2011 13:51
First event creation form using the Eventbrite class
<?php
/*This script does the following:
1. Loads the eventbrite client library
2. Get all variables form form
3. Puts my eventbrite account details into an array
4. Gets the submitted data and puts into an array
5. Passes data to API to create event
6. Recieve a confomation ticket of newly created event*/
@matherton
matherton / css styles for twitter.php
Created October 31, 2011 14:29
PHP file that parses twitter feed
/*basic styles to display tweets by Mark Atherton*/
ul.tweets {
list-style-type: none;
background-color: #fbfbde;
width: 300px;
padding: 0.25em 1.5em 0.25em 1.5em;
}
ul.tweets h5{
font-size: 1.15em;
@matherton
matherton / sponsor.css
Created October 31, 2011 17:08
code for sponsor section in right-hand column of the stage events website
p.small-italics {
font-style: italic;
font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, helvetica, arial, sans-serif;
font-size: smaller;
line-height: 30%;
}
.sponsor {
width: 300px;
height: 300px;
@matherton
matherton / calendar.php
Created November 15, 2011 17:57
This form generates a calendar and poulates it with event data from my localhost MySQL DB
<?php
/* Database connection to test database */
$connection = mysql_connect('localhost','wp_user','wp_password');
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("wordpres",$connection);
?>
<html>
@matherton
matherton / scroll.html
Created February 27, 2012 16:44
Basic jQuery tools scroll
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<head>
<!-- include the Tools -->
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script>
@matherton
matherton / coffee script - relativefixed positioning
Created April 10, 2012 14:56
coffee scrip - relative and fixed positioning dependant on if div is viewable on screen
# code for the advert preview and the "why go premium list" on the create new ad form so that it only adopts fixed positioning when all of it is in view.
$ ->
e = $("div#advert_preview")
jWindow = $(window)
offsetTop = e.offset().top
positionTop = e.position().top
jWindow.scroll ->
if jWindow.scrollTop() > offsetTop
e.css
@matherton
matherton / The stage directory template
Created April 12, 2012 15:34
Email template using base64 to embed images directly in email
<table width='100%' border='0' cellpadding='4' cellspacing='0'>
<tr>
<td height='50' colspan='4' bgcolor='#000000'><a href='http://www.thestage.co.uk'><img border='0' src='data:image/jpg;base64,R0lGODlhsAAaAPcAAObm5qCgoHJyckpKSujo6LKyssHAwNbW1oyMjNDQ0L29vYKCghoaGhwcHAoK
CjQ0NE5OTn5+fnp6eqampmRkZMjIyEJCQq6urmhoaMrKypSUlMTFxZKSklRVVHR0dA0NDZuamrm5
uZiZmHh4eHx8fIaGhmFiYkZGRhUVFbCwsJ+enqSlpV5eXh4eHlBQUGBgYBISEoSEhFxcXICAgGZm
ZjY2NoqKigQEBGtra0RERDg4OFhYWJCQkI6Pjjw8PCoqKp2dnTo6OiwsLCMjI29vbyIiIr+/vxAQ
ECgoKDAwMFtaWi8uLz4+PlZXVnZ2dsXFxYmJia+urx0dGyAgICYmJlNTUycmJGpqZERDP/T09DMz
M/Pz8zIyMvj4+Pr6+vn5+YeGf8fHx359dk1NSc7OzvX19dra2nRzbampqWFgW7a2tvv7+7W1tfLy
8jo6NtnZ2c3Nze7u7u/v7/z8/IKCgZaWlv39/f7+/rq6uq2trdLS0tTU1DAwLVdWUuDg4KysrOHh
4aurq6qqquvr65eXl8/Pz9vb2/b29t3d3d7e3uXl5djY2PHx8e3t7ff396urqszMzNXV1eLi4ru7
@matherton
matherton / user_controller.rb
Created April 25, 2012 13:35
rails controller using pony gem to send internal email
class UsersController < ApplicationController
before_filter RubyCAS::Filter, :except => :cas_update_user
before_filter :check_user, :except => :cas_update_user
def promote
error = "Please enter your name" if params[:name].blank?
error = "Please enter your telephone number" if params[:telephone].blank?
error = "Please enter a valid email address" unless params[:email].match(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}/)
if error.blank?
@matherton
matherton / insightinternet tweets
Created September 3, 2012 09:33
JavaScript to parse my json twitter feed.
JQTWEET = {
// Set twitter username, number of tweets & id/class to append tweets
user: 'insightinternet',
numTweets: 3,
appendTo: '#jstwitter',
// core function of jqtweet
loadTweets: function() {
$.ajax({