Skip to content

Instantly share code, notes, and snippets.

View dmolsen's full-sized avatar

Dave Olsen dmolsen

View GitHub Profile
@dmolsen
dmolsen / bubble-range.js
Created July 9, 2012 13:50
jQuery-less version of Chris Coyier's Value Bubbles for Range Inputs
/**********************************************************
* jQuery-less version of Chris Coyier's
* Value Bubbles for Range Inputs
* http://css-tricks.com/value-bubbles-for-range-inputs/
**********************************************************/
function modifyOffset() {
var el, newPoint, newPlace, offset, siblings, k;
width = this.offsetWidth;
newPoint = (this.value - this.getAttribute("min")) / (this.getAttribute("max") - this.getAttribute("min"));
@dmolsen
dmolsen / _content.scss
Last active December 14, 2015 12:19
sass-ified example of styles
// base styles for the content container div
.content {
width: 100%;
margin: 0;
padding: 0 1.25em 1.25em 1.25em;
background-color: #fff;
float: left;
}
// break at 31.25em, builds on the base
@dmolsen
dmolsen / instagram code generator
Created April 5, 2013 16:25
The URL to generate the code that lets one generate an Instagram access token.
https://api.instagram.com/oauth/authorize/?client_id=[clientID]&redirect_uri=[redirectURI]&response_type=code
curl -F 'client_id=[clientID]' -F 'client_secret=[clientSecret]' -F 'grant_type=authorization_code' -F 'redirect_uri=[redirectURI]' -F 'code=[code]' https://api.instagram.com/oauth/access_token
@dmolsen
dmolsen / cli.php
Created April 6, 2013 15:45
A very simple example of setting up a command line tool using PHP
<?php
/*
* A ridiculously simple example of using PHP as a command line tool
*
* The following usage is supported by this script:
*
* php cli.php -a [-c]
* Do something based on the -a flag. Use the optional -c flag to modify what happens when using the -a flag.
*
@dmolsen
dmolsen / gist:7489066
Created November 15, 2013 18:16
Loading jQuery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="styleguide/js/jquery.js"><\/script>')</script>
@dmolsen
dmolsen / PL v0.7.0 navItems
Created January 9, 2014 15:32
This is the organization and naming scheme for $this->navItems in v0.7.0 of Pattern Lab
Array
(
[patternTypes] => Array
(
[0] => Array
(
[patternTypeLC] => atoms
[patternTypeUC] => Atoms
[patternType] => 00-atoms
[patternTypeDash] => atoms
@dmolsen
dmolsen / PL v0.7.0 patternPaths
Created January 9, 2014 15:41
The patternPaths array from v0.7.0 of Pattern Lab
Array
(
[atoms] => Array
(
[head] => Array
(
[patternSrcPath] => 00-atoms/00-meta/_00-head
[patternDestPath] => 00-atoms-00-meta-_00-head
[patternPartial] => atoms-head
[render] =>
@dmolsen
dmolsen / header.mustache
Created February 18, 2014 16:02
An example header pattern from Pattern Lab
<!-- Begin .header -->
<header class="header cf" role="banner">
{{> atoms-logo }}
<a href="#search-form" class="nav-toggle nav-toggle-search icon-search"><span class="is-vishidden">Search</span></a>
<a href="#nav" class="nav-toggle nav-toggle-menu icon-menu"><span class="is-vishidden">Menu</span></a>
{{> molecules-primary-nav }}
{{> molecules-search }}
</header>
<!-- End .header -->
@dmolsen
dmolsen / pattern-lab-export.md
Created May 31, 2014 19:59
Exporting Patterns from Pattern Lab

Exporting Patterns from Pattern Lab for Drupal 8 Themes

I'm going to use Drupal as my guinea pig when thinking about this because Marc has shown the most interest in trying to make this happen. The holy grail does seem to be creating a way to have PL live with a remote project. Right now it's very good for the development but falls short or probably requires a lot of work if used as part of maintenance.

In order to work well for Drupal I would assume we'd have to tackle the following three problems:

  1. Develop patterns in the native format (Twig)
  2. Store or export patterns so they match the destination format (theme structure)
  3. Sync the exported patterns with a remote system