Skip to content

Instantly share code, notes, and snippets.

@CWSpear
CWSpear / ajaxify-html5.js
Created July 8, 2012 05:16 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/3069522
;(function($, window, document, undefined) {
// Prepare our Variables
var History = window.History;
// Check to see if History.js is enabled for our Browser
if (!History.enabled) {
return false;
}
@bartrail
bartrail / gist:4534893
Last active December 11, 2015 02:59
This is a plugin for the famous RoyalSlider by Dmitry Semenov. It adds HTML5 History API support for sliding through images or content. Basically it replaces the deeplinking plugin - which is already great and very much useful for most cases. But I needed named urls and more custom features, also Dimitry suggests to build an own plugin, well her…
(function($) {
/**
*
* This plugin is released under the MIT Licene (http://opensource.org/licenses/MIT)
*
* RoyalSlider HTML5 HistoryApi Plugin by Conrad Barthelmes
*
* @requires RoyalSlider http://dimsemenov.com/plugins/royal-slider/
* @requires History.js API https://github.com/balupton/History.js/
* - bundled jquery.history.js for html4+html5 support
@keithmancuso
keithmancuso / Add a job form
Created May 18, 2014 20:22
Add a job form
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="account/jobs?added={id}">
<input type="hidden" name="sectionId" value="9">
<input type="hidden" name="enabled" value="0">
<div class="form-group">
<label for="title">Job Title</label>
<input id="title" type="text" class="form-control" name="title">
</div>
@greenbicycle
greenbicycle / goaccess-install
Created September 8, 2016 03:58
GoAccess install for Ubuntu and Debian
#!/bin/bash
#
# After this is run, edit /etc/goaccess.conf as needed
#
echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install goaccess
@eusonlito
eusonlito / goaccess.sh
Last active September 27, 2016 11:01
Goaccess install into Ubuntu Xenial
# Add goaccess repository
echo "deb http://deb.goaccess.io/ xenial main" > /etc/apt/sources.list.d/goaccess.list
# Add repository keys
gpg --keyserver keyserver.ubuntu.com --recv-key 742483B7B222C443
gpg -a --export 742483B7B222C443 | apt-key add -
# Update apt
apt-get update
@thomasmb
thomasmb / gist:b67680a04ae75bc301b7
Created August 11, 2014 14:03
Google Webfonts
WebFontConfig = {
google: { families: [ 'PT+Sans:400,400italic:latin', 'Ubuntu:300,400,500:latin' ] }
};
var cb = function() {
var wf = document.createElement('script');
wf.src = '//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
@aelvan
aelvan / macro.twig
Created September 23, 2015 15:07
Twig macro for creating a srcset string in Craft
{% macro getSrcSet(image, sizes, upscale) %}
{%- spaceless %}
{% set sizesOut = [] %}
{% set allowScaleLarger = upscale | default(false) %}
{# loop over sizes parameter and generate transforms #}
{% for size in sizes %}
{%- spaceless %}
{% set currentTransform = {} %}
@bittu
bittu / animate-elem-horizontal-scroll.js
Last active November 17, 2017 10:03
Scroll any element horizontally with smooth animation without any library.
const easeInQuad = (t, b, c, d) => {
return c * (t /= d) * t + b;
}
const requestAnimFrame = (() => {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function( callback ){ window.setTimeout(callback, 1000 / 60); };
})();
export const scrollElementLeftTo = (element, to, duration = 400, callback) => {
const move = (amount) => {
{% if entry.homepageHeroDesktop|length > 0 and entry.homepageHeroMobile|length > 0 %}
<div class="homepage-hero homepage-hero--image">
<figure>
<picture>
{% set homepageHeroDesktop = entry.homepageHeroDesktop.first().getUrl() %}
{% set homepageHeroMobile = entry.homepageHeroMobile.first().getUrl() %}
<!--[if IE 9]><video style="display: none;"><![endif]-->
<source srcset="{{ homepageHeroDesktop }}" media="(min-width: 540px)">
.random-color {
border-top-color: "LightCoral";
border-right-color: #a44b58;
border-bottom-color: rgb(108, 188, 134);
border-left-color: rgb(24%, 88%, 5%);
outline-top-color: hsl(88, 69%, 69%);
outline-right-color: rgba(220, 71, 132, 0.69);
outline-bottom-color: rgba(79%, 47%, 14%, 0.37);
outline-left-color: hsla(111, 31%, 38%, 0.86);
}