Skip to content

Instantly share code, notes, and snippets.

@wihodges
wihodges / Craft Load Posts from Element API Jquery Ajax
Last active November 22, 2022 12:29
I need a simple way to load more post to a news section in Craft CMS using Element API plugin and Jquery
<?php
use craft\elements\Entry;
use craft\helpers\UrlHelper;
return [
'endpoints' => [
'news.json' => function() {
return [
'elementType' => Entry::class,
@wihodges
wihodges / Craft Load Posts from Element API Jquery Ajax
Created November 30, 2018 18:34
I need a simple way to load more post to a news section in Craft CMS.
<?php
use craft\elements\Entry;
use craft\helpers\UrlHelper;
return [
'endpoints' => [
'news.json' => function() {
return [
'elementType' => Entry::class,
@wihodges
wihodges / gist:7362ece9a6f373ea896a65bde99b7fc3
Last active July 18, 2018 03:13
Regex in Atom for all GA Tracking codes
//FIND ALL
UA-([0-9])\w+-[0-9]
REPLACE WITH WHATEVER
(function() {
var m = void 0,
n = !0,
p = null,
q = !1,
s = {};
window.nogic = s;
function t(a, c, d, b, e, f, g, h, y, k, u) {
this.n = f;
@wihodges
wihodges / 0_reuse_code.js
Created January 13, 2016 18:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wihodges
wihodges / osx-10.11-setup.md
Created December 10, 2015 21:00 — forked from kevinelliott/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

@wihodges
wihodges / gist:8478326
Created January 17, 2014 18:03
Foundation 5 + Statamic Theme Gruntfile
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
@wihodges
wihodges / prev-next-pagination
Last active December 31, 2015 19:09
Previous/Next pagination for Statamic entries.
<div class="pagination">
{{ if prev }}
<div class="previous">
<a href="{{ prev }}">Previous</a>
</div>
{{ endif }}
{{ if next }}
<div class="next">
<a href="{{ next }}">Next</a>
</div>