Skip to content

Instantly share code, notes, and snippets.

@almonk
almonk / usage_example.js
Created May 31, 2011 11:02 — forked from jgwhite/with-history.js
Simple pushState wrapper
$(document).bind("WithHistory.urlDidChange", function() {
$.ajax(window.withHistory.url(), {
dataType: "html",
success: function(response) {
var body = response.match(/<body.*?>([\s\S]+?)<\/body>/)[1];
var tmp = $("<div />");
tmp.html(body);
var newContent = tmp.find("#pagecontent").html();
$("#pagecontent").animate({ opacity: 0 }, 250);
@almonk
almonk / FacebookLike.module
Created June 2, 2011 10:22
Facebook Like module for Processwire
<?php
class FacebookLike extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Facebook Like Button',
'version' => 101,
'summary' => 'Display Facebook like buttons on your Processwire site.',
@almonk
almonk / Analytics.module
Created June 20, 2011 10:49
Google Analytics module for Processwire
<?php
class Analytics extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Google Analytics',
'version' => 101,
'summary' => 'Adds some quick hooks for the Google Analytics Service',
{% extends 'default.html' %}
{% block main %}
<h1>{{page.title}}</h1>
{{ page.body | markdown }}
{% endblock %}
template : post
title: Home
posts :
- title: This is my first post
body: Testing out Caret cms :)
- title: This is my second post
body: Lorem ipsum dolor ist...
<article>
{% for post in page.posts %}
<h2>{{ post.title }}</h2>
{{ post.body }}
{% endfor %}
</article>
def next
project.images.first(:conditions => ["position > ?", position], :order => "position asc")
end
def prev
project.images.last(:conditions => ["position < ?", position], :order => "position desc")
end
@mixin background-image-retina($file, $type, $width, $height) {
background-image: url($file + '.' + $type);
@media (-webkit-min-device-pixel-ratio: 2), (-moz-min-device-pixel-ratio: 2) {
& {
background-image: url($file + '@2x.' + $type);
-webkit-background-size: $width $height;
}
}
}
<area title=" Outgoings">
<feature type="Lease">
<heading>Lease</heading>
<description>94 years remaining</description>
</feature>
<feature type="Ground Rent/Maintenance">
<heading>Ground Rent/Maintenance</heading>
<description>£721.30 per annum.</description>
</feature>
<feature type="NB">
(function(i) {
'use strict';
console.log(i); // undefined
console.log(bar); // function
console.log(animals); // undefined
console.log('-------------------------');
var i = 2;