Skip to content

Instantly share code, notes, and snippets.

View jaspertandy's full-sized avatar

Jasper jaspertandy

View GitHub Profile
<div style="background-color:#fff;display:inline-block;font-family:'Helvetica Neue',Arial,sans-serif;color:#a7a7a7;font-size:11px;width:100%;"><div style="overflow:hidden;position:relative;height:0;padding:150.379747% 0 49px 0;width:100%;"><iframe src="//embed.gettyimages.com/embed/169192857?et=AeJi6xj_SahLhQXgfsPJNw&sig=bmxaxNpmY6oNWL47DUU59EY6JO7S5y49kZNtWEsGRII=" width="398" height="655" scrolling="no" frameborder="0" style="display:inline-block;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></div><p style="margin:0;"></p><div style="padding:0;margin:0 0 0 10px;text-align:left;"><a href="http://www.gettyimages.com/detail/169192857" target="_blank" style="color:#a7a7a7;text-decoration:none;font-weight:normal !important;border:none;">#169192857</a> / <a href="http://www.gettyimages.com" target="_blank" style="color:#a7a7a7;text-decoration:none;font-weight:normal !important;border:none;">gettyimages.com</a></div></div>
<?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