Skip to content

Instantly share code, notes, and snippets.

View jnowland's full-sized avatar

James Nowland jnowland

View GitHub Profile
{% comment -%}
#----------------------------------
# Meta Details - /Templates/_includes/html.metaDetails.tpl
#----------------------------------
To use this meta template insert the above variables above the include:
{% assign metaTitle = "" -%}
{% assign metaDescription = "" -%}
{% assign metaTags = "" -%}
{% assign metaCategory = "" -%}
{% assign metaTwitterHandle = "" -%}
<snippet>
<content><![CDATA[
@include breakpoint(${1:papa-bear / mama-bear / baby-bear}) {
${2:}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>mq</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@jnowland
jnowland / display-categories.twig
Last active February 28, 2017 16:53
Craft Snippets
{# Shows all categories in the news group #}
{% set categories = craft.categories.group('news') %}
<ul>
{% nav category in categories %}
<li>
<a title="{{ category.title }}" href="{{ category.url }}">{{ category.title }}</a>
{# Output a nested <ul> if this category has any children #}
{% ifchildren %}
<ul>{% children %}</ul>
@jnowland
jnowland / SassMeister-input.scss
Created February 26, 2017 09:20
Precise control over responsive typography for Sass
// ----
// libsass (v3.3.6)
// ----
// =========================================================================
//
// PRECISE CONTROL OVER RESPONSIVE TYPOGRAPHY FOR SASS
// ---------------------------------------------------
// Indrek Paas @indrekpaas
//
@jnowland
jnowland / freemember-bday-selectors.php
Created July 23, 2013 06:06
Select boxes for birthday in freemember echos out bday_d , bday_m, bday_y for expression engine. Works with PHP on output.
<div class="control-group">
<label for="{pr_form_id}-date-of-birth">Date of Birth</label>
<select id="{embed:form_prefix}-bday_d" name="bday_d" class="dob-day">
<option value="">Day</option>
<?php for ($i=1; $i < 32; $i++) : ?>
<option value="<?php echo $i ?>"
<?php echo ($i == "{bday_d}") ? 'selected="selected"' : "" ?>
>
<?php echo $i ?></option>
@jnowland
jnowland / calculators.scss
Last active March 30, 2016 23:43
Using EM's
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
@function em($target, $context: $base-font-size, $unitless: false) {
@if ($unitless == false) {
@return ($target / $context) * 1em;
}
@else {
@return strip-units(($target / $context));
@jnowland
jnowland / 0-model-override.js
Created March 23, 2016 04:18 — forked from spencermefford/0-model-override.js
An alternative to extending Loopback's built in models. In our application, we wanted to create a custom role called "ecm-administrator" that would have the ability to create and manage users.
module.exports = function (app) {
var _ = require('lodash');
var User = app.models.User;
var Role = app.models.Role;
var RoleMapping = app.models.RoleMapping;
var ACL = app.models.ACL;
/*
* Configure ACL's
*/
@jnowland
jnowland / Add files to .txt
Created March 8, 2016 01:29
Linux Commands for assests
ls > filenames.txt
@jnowland
jnowland / Separator-1.scss
Last active December 31, 2015 16:48
Modifiers and BEM Question.
// method does not set a default.
.Separator{
}
.Separator--1{
border-style: dashed;
border-color: $colour--Neutral600;
border-width: 0 0 1px 0;
}
@jnowland
jnowland / count.js
Last active December 24, 2015 06:49
DISQUS comment count code uncompressed.
var DISQUSWIDGETS, disqus_domain, disqus_shortname;
typeof DISQUSWIDGETS == "undefined" && (DISQUSWIDGETS = function () {
var d = {}, m = document.getElementsByTagName("HEAD")[0] || document.body,
n = 0,
f = {}, j = {
identifier: 1,
url: 2,
slug: 3
};
d.domain = "disqus.com";