Skip to content

Instantly share code, notes, and snippets.

View neilbradley's full-sized avatar

Neil Bradley neilbradley

View GitHub Profile
@hendrikeng
hendrikeng / _lazyFocusImager.twig
Last active December 14, 2021 13:17
Twig/Craft macro for lazy responsive images/bgimages with Imager and Focuspoint
{#
// lazyLoaded Image/bgImages, optimized with Imager and Focuspoint
---------------------------------------------------------------------------
https://github.com/aelvan/Imager-Craft
https://github.com/smcyr/Craft-FocusPoint
for the bgImage intrinsic ratio classname creation check:
https://github.com/inuitcss/inuitcss/blob/develop/objects/_objects.ratio.scss
https://github.com/constancecchen/object-fit-polyfill
@brandonkelly
brandonkelly / templating.md
Last active February 7, 2024 15:20
Templating in EE vs. Craft
@bjornbjorn
bjornbjorn / map.html
Last active November 20, 2017 13:17
Search bar + drag and drop pin to let users specify a geolocation - results saved to lat/long input fields (which can be hidden in the form)
<!DOCTYPE html>
<html lang="nb">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
</head>
<body>
@bluespore
bluespore / JS: EE Ajax Load
Last active December 14, 2015 10:39
Interacts with AJAX Templates set up in ExpressionEngine. Functionality can obviously be changed to allow Lazy Loading, but this is the basic set up for future referencing.
$('body').delegate('.load-more', 'click', function(e){
//Vars
var
me = $(this),
target = me.attr('href'),
split = target.split('/'),
offset = split[split.length-1],
new_target = '',
container = me.attr('data-container'),
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@clifff
clifff / comments.json
Last active December 12, 2015 01:38
Comment mapping
This file has been truncated, but you can view the full file.
{"1359925200":[{"timestamp":1359925200,"community_id":117,"lat":38.0,"long":-97.0},{"timestamp":1359925200,"community_id":46,"lat":40.675899505615234,"long":-73.7968978881836},{"timestamp":1359925200,"community_id":378,"lat":41.777000427246094,"long":-72.52359771728516},{"timestamp":1359925200,"community_id":260,"lat":42.72840118408203,"long":-73.69180297851562},{"timestamp":1359925200,"community_id":111,"lat":39.896400451660156,"long":-75.34629821777344},{"timestamp":1359925200,"community_id":162,"lat":30.452699661254883,"long":-91.06780242919922},{"timestamp":1359925200,"community_id":25,"lat":40.04859924316406,"long":-83.07260131835938},{"timestamp":1359925200,"community_id":270,"lat":41.70389938354492,"long":-72.54609680175781},{"timestamp":1359925200,"community_id":242,"lat":42.208099365234375,"long":-70.7750015258789},{"timestamp":1359925200,"community_id":144,"lat":39.16529846191406,"long":-86.52639770507812},{"timestamp":1359925200,"community_id":373,"lat":34.81679916381836,"long":-86.68250274658203},
@low
low / low-search-ajax.js
Last active October 18, 2020 13:21
Using Low Search for ExpressionEngine with Ajax. Change any of the three variables on top to suit your needs. Tested with jQuery 1.9.0.
(function($){
$(function(){
var $form = $('#search'), // Search form
$target = $('#results'), // Results container
rp = 'search/ajax-results'; // Template for results only
// Function to execute on success
var success = function(data, status, xhr) {
$target.html(data);
};
@tomdavies
tomdavies / HowTo.md
Created November 29, 2012 00:35
ExpressionEngine Google Analytics Site Search

Google Analytics Site Search

New GA.js script allows to track EE searches

Google updated their Analytics code from their former Urchin script (urchin.js) to their own Google Analytics (gs.js) that now allows to track:

  • Site Search (e.g EE site search)
  • Events (e.g file downloads) (still in closed beta Jan.11.2008)

Preparation

<title>{title}{site_name}</title>
<meta name='keywords' content='{meta_keywords}' />
<meta name='description' content='{meta_description}' />
<link rel='canonical' href='{canonical_url}' />
<meta property="og:url" content="{canonical_url}"/>
<meta property="og:title" content="{entry_title}"/>
<meta property="og:description" content="{extra:desc}"/>
<meta property="og:image" content="{extra:image}"/>
@1stevengrant
1stevengrant / config.php
Created October 28, 2012 17:21
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;