Skip to content

Instantly share code, notes, and snippets.

@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 / .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_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 / 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,
@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) %}
@johanneslamers
johanneslamers / vue.twig
Created September 22, 2016 11:15 — forked from mmikkel/vue.twig
Vue.js Craft template
{% includeJsFile('https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.js') %}
{% set script %}
Vue.config.debug = true;
Vue.config.delimiters = ['${', '}'];
new Vue({
el: '#content',
data: {
message: 'Hello Vue.js!'
@johanneslamers
johanneslamers / json-sample.twig
Created September 22, 2016 11:22 — forked from WietseWind/json-sample.twig
nodum vuejs sample progress-bar
{{ [
{ id: 1, name: "Wietse", donkerblauw: 10, blauw: 20 },
{ id: 2, name: "Thomas", groen: 20, oranje: 40 },
{ id: 3, name: "Pepper", oranje: 90, groen: 5 },
{ id: 4, name: "Henk", blauw: 40, oranje: 20 }
]|json_encode }}
@johanneslamers
johanneslamers / ajax_get.twig
Created September 22, 2016 11:27 — forked from WietseWind/ajax_get.twig
Inline edit + AJAX + VueJS using nodum
{% trim %}
{{ mongo.find({ deleted : { '$exists' : false } })|json_encode }}
{% endtrim %}
@johanneslamers
johanneslamers / set-project-perms.sh
Created September 22, 2016 11:28 — forked from khalwat/set-project-perms.sh
Properly set permissions for a Craft CMS install, including ensuring that files are all g-x. Set CHOWN_USER, CHOWN_GROUP, and BASE_DIR to whatever is appropriate, add directories that need to be writeable by the web server to DIRS[], then execute: sudo ./set-project-perms.sh PROJECT_NAME
#!/bin/bash
# Execute via: ./set-project-perms.sh PROJECT_NAME
# The paradigm is the entire project dir is owned by $CHOWN_USER with the group set to $CHOWN_GROUP
# $CHOWN_USER is an admin or user account that is used to edit files/templates, etc.
# $CHOWN_GROUP is the group of the webserver (e.g.: 'apache', 'nginx', 'httpd', etc.)
# The project dir permissions are set to 755 (-rwxr-xr-x) for directories and to 644 (-rw-r--r--) for files
# The permissions to $DIRS[] that need to be writeable are set to 775 (-rwxrwxr-x) for directories and
# 664 (-rw-rw-r--) for files. Add any assets directories, etc. as necessary.
# Change $BASE_DIR to the absolute path where your websites are stored (leaving it appended with '/$1')