Skip to content

Instantly share code, notes, and snippets.

@almonk
almonk / con.js
Last active August 29, 2015 14:12
function car() {
return {
start: function() {
console.log("Engine on.");
},
accelerate: function() {
console.log("Let's go!");
}
};
}
@almonk
almonk / menu.rb
Last active August 29, 2015 14:27
class Menu < Page
def entry?
true
end
def template
"menu_set/views/show"
end
@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 / 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">