Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mozzarella>
<menu>
<links>
<link default="projects" label="Projects">
<menu>
<links>
<link node="projects" label="Projects"/>
<link node="specialisations" label="Specialisations"/>
</links>
<div id="competition" class="pushSidebar contentWrap">
<div id="innerWrap" class="clearFix">
<div id="primary">
<h1>Win a pair of Supra Blah</h1>
<p class="intro">Fill in your details to win.</p>
<form action="/competition/enter" method="post">
<fieldset>
<div class="field">
<label for="name">Name</label>
#competition h1 {
margin-left: 0;
margin-bottom: 16px;
}
#competition .intro {
margin-bottom: 25px;
}
#competition #primary {
<record tableName="homepage_boxes" tableUrl="homepage-boxes" name="Homepage Boxes">
<fields>
<section name="">
<link field="box_type" name="Type" type="dropdown" tableName="homepage_box_types" uid="homepageboxtype">
<linkOptions field="name" orderBy="name ASC" allowNull="false"/>
</link>
<templateGroup name="News Types" link="homepageboxtype">
<template id="1" name="Section">
<text field="transition_every" name="Transition Every" width="80" comment="1/1000th second"/>
</template>
<?php
class Competition_Validation extends Validation {
protected $competition;
protected $guess;
public function init(){
$this->add_rule( 'name' , 'required' );
$this->add_rule( 'email' , 'required' );
$this->add_rule( 'email' , 'email' );
$this->add_rule( 'answer' , array( $this , 'valid_competition' ) );
in functions.php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150 ); // default Post Thumbnail dimensions
add_image_size('homepage-image', 327, 218, true);
add_image_size('single-image', 675, 450, true);
}
then in the single.php i have
function myfloor( $value , $precision = 0 ){
$multiplier = (int) ("1" . str_repeat( 0 , $precision ));
return floor( $value * $multiplier ) / $multiplier;
}
function myceil( $value , $precision = 0 ){
$multiplier = (int) ("1" . str_repeat( 0 , $precision ));
return ceil( $value * $multiplier ) / $multiplier;
}
require 'net/http'
require 'uri'
Earthquake.init do
output_filter do |item|
next unless item['text']
text = item["text"]
text.scan( /http:\/\/t\.co\/[a-zA-Z0-9\-]+/ ).each do |url|
uri = URI.parse url
Net::HTTP::start( uri.host , uri.port ) do |connection|
connection.request_get uri.path do |response|
@jaspertandy
jaspertandy / gist:1419991
Created December 1, 2011 21:25
AJN Ipsum TextExpander Shell Script
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'nokogiri'
html = Nokogiri::HTML( Net::HTTP.get( URI.parse( 'http://old.jamesmoss.co.uk/ajn.php' ) ) )
out = []
html.xpath( '//p' ).to_a.each do |p|
out.push p.to_s
case "casestudy":
$meta = getmeta($info->id, 'casestudy');
$title = $meta->meta_title;
$link = "casestudy/".$info->url;
$backtrace .= ' &gt; <a href="/casestudies-hub/">Case Studies</a>';
break;
case "faq":
$title = $info->question;
$link = "faq/";