Skip to content

Instantly share code, notes, and snippets.

@johanneslamers
johanneslamers / nginx.conf
Last active September 3, 2020 17:31
Craft CMS Nginx config for Laravel Forge with locale support
server {
listen 80 default_server;
server_name default;
root /home/forge/default/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
@johanneslamers
johanneslamers / javascript_resources.md
Created August 28, 2014 12:47 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@johanneslamers
johanneslamers / css_resources.md
Created August 28, 2014 12:47 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@johanneslamers
johanneslamers / craftcms_varnish.vcl
Last active February 26, 2019 02:46 — forked from aelvan/gist:eba03969f91c1bd51c40
Varnish 4.0 file for our Craft CMS projects
# Varnish 4.0 file for our Craft CMS projects
# Based on https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
#
# This is still work in progress, comments appreciated.
vcl 4.0;
import std;
import directors;
@johanneslamers
johanneslamers / distanceCalculator.twig
Last active September 22, 2016 10:04
Craft CMS automatic distance calculator between site visitor and entry author
{% set author = entry.author.city %}
{% set visitor = craft.geo.info.city %}
{% set response = craft.googleMaps.directions({
origin: visitor,
destination: author,
language: 'nl',
avoidFerries: false,
avoidHighways: false,
avoidTolls: false,
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:PutObject",
"s3:PutObjectAcl"
],
@johanneslamers
johanneslamers / inspiration
Created January 18, 2016 14:02 — forked from meodai/inspiration
Sexy Frontend
One-pager / Scroll:
- http://sanfranciscointernationalbookclub.com/
- http://sfcd.com/
- http://www.leannebentley.co.uk/
- http://forrestlesssleepers.com/
- http://swaywater.com/
- http://mediacityseoul.kr/2016/pre/
- https://ustwo.com/
- http://mailchimp.com/2015/
- http://molamil.com/
@johanneslamers
johanneslamers / ajax_paging.twig
Last active September 22, 2016 09:56 — forked from keithmancuso/gist:17619fc405a621b4a11e
Craft Ajax Paging
{% if craft.request.isAjax %}
{% set layout = "_ajaxLayout" %}
{% else %}
{% set layout = "_layout" %}
{% endif %}
{% extends layout %}
{% set limit = 10 %}
{% set params = { section: 'news', limit: limit} %}
@johanneslamers
johanneslamers / .readme.md
Created May 30, 2016 12:12 — forked from jmyrland/.readme.md
Off canvas menu with touch handles.

Off canvas menu with touch handles.

View an example here.

This example is based on elements of this post.

Incliudes a OffCanvasMenuController to handle touch events bound to the off canvas menu. For example when swiping from the outer left side to the right, the left off canvas menu is dragged along.

Example usage

@johanneslamers
johanneslamers / ajax-team.twig
Created September 22, 2016 11:15
Craft - load more with AJAX
{% set teamIdsToExclude = ['and'] %}
{% for excerpt in craft.entries.section('team').limit(12) %}
{% set teamIdsToExclude = teamIdsToExclude|merge([excerpt.id]) %}
{% endfor %}
{# Convert the teamIdsToExclude array into a comma separated list #}
{% set teamIdsToExcludeString = teamIdsToExclude|join(', not ') %}
{% for excerpt in craft.entries.section('team').id(teamIdsToExcludeString) %}