Skip to content

Instantly share code, notes, and snippets.

View jasonvarga's full-sized avatar
🇦🇺

Jason Varga jasonvarga

🇦🇺
View GitHub Profile
@jasonvarga
jasonvarga / gist:7492871
Created November 15, 2013 22:38
Copy billing to shipping using jQuery
<form>
<fieldset>
<legend>Billing</legend>
<input type="text" name="first_name" />
<input type="text" name="last_name" />
<input type="text" name="billing_address_1" />
<input type="text" name="billing_address_2" />
<input type="text" name="billing_city" />
<input type="text" name="billing_state" />
<input type="text" name="billing_zip" />
@jasonvarga
jasonvarga / my-post.txt
Last active January 1, 2016 15:59
Related entries using Statamic's Suggest fieldtype
--
title: My Post
related_entries:
- /blog/related-post-1
- /blog/related-post-2
---
This is actually your post's md file. I named it txt otherwise Github will try to format it as markdown and it looks funky.
@jasonvarga
jasonvarga / gist:8293832
Created January 7, 2014 02:35
Bison Best Sellers tag example
{{ bison:best_sellers }}
{{ if no_results }}
<p>I dunno? Nothing has been sold yet.</p>
{{ else }}
{{ if first }}
<ul>
{{ endif }}
<li><a href="{{ url }}">{{ title }} has sold {{ total_sales }} times</li>
{{ if last }}
</ul>
@jasonvarga
jasonvarga / Gruntfile.js
Created January 17, 2014 16:47
Getting Grunt to watch Statamic files
module.exports = function(grunt) {
grunt.initConfig({
...
themePath: '_themes/theme_name',
watch: {
options: { livereload: true },
css: {
@jasonvarga
jasonvarga / Gruntfile.js
Last active January 4, 2016 15:19
Using Grunt to copy Statamic add-on files to a sandbox site
module.exports = function(grunt) {
grunt.initConfig({
concat: {
// js stuff
},
uglify: {
// more js stuff
@jasonvarga
jasonvarga / option-one
Created February 20, 2014 23:50
Inline CMS CSS output
{{ entries:listing }}
<div class="entry-{{ count }}"></div>
{{ /entries:listing }}
<style>
{{ entries:listing }}
.entry-{{ count }} { background: {{ image }}; }
{{ /entries:listing }}
</style>
@jasonvarga
jasonvarga / hooks.rename_date_fields.php
Last active August 29, 2015 13:59
Small add-on to rename Statamic's date/time fields.
<?php
class Hooks_rename_date_fields extends Hooks
{
public function control_panel__add_to_foot()
{
if (URL::getCurrent() == '/publish') {
return $this->js->inline('
var form = $(".primary-form");
form.find("label:contains(\'Publish Date\')").text("New date field name");
@jasonvarga
jasonvarga / form.html
Last active September 5, 2021 23:34
Using Statamic HTML Caching with a dynamic Raven form. Put the form on a separate page and pull it in via JS.
<!--
A template for raven stuff.
Display this at a URL like /contact-form for example
Exclude this URL from html_caching
Make this form look/act like it was part of the parent page.
The contents of #raven will be injected into it.
-->
@jasonvarga
jasonvarga / Gruntfile.coffee
Created August 25, 2014 14:34
Statamic Add-on Gruntfile
module.exports = ->
@initConfig
sandbox: '/users/jason/sites/statamic-sandbox'
copy:
sandbox:
files: [
expand: true
cwd: '_add-ons/calendar/'
src: '**'
@jasonvarga
jasonvarga / calendar_month.html
Last active October 2, 2015 19:48
Creating a single page dynamic URL calendar. This assumes a URL scheme like /calendar/month/2015/01
{{ calendar:set_month folder="calendar" year="{ segment_3 }" month="{ segment_4 }" }}
<h1>{{ calendar:month_name }} {{ segment_3 }}</h1>
{{ calendar:prev_month }}
<a href="/calendar/month/{{ year }}/{{ month }}" title="{{ month_name }} {{ year }}">&larr; Prev</a>
{{ /calendar:prev_month }}
{{ calendar:date_select attr="id:month-select" }}