Skip to content

Instantly share code, notes, and snippets.

View SiTaggart's full-sized avatar

Simon Taggart SiTaggart

View GitHub Profile
@SiTaggart
SiTaggart / ajaxexample.js
Created February 6, 2012 22:46
Simple $.ajax example
$.ajax({
url: ,
data: {},
dataType: JSON,
type: POST,
success: function(data, textStatus, XMLHttpRequest) {
// Do something with the data
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
//handle error
@SiTaggart
SiTaggart / simpletabsexample.js
Created February 15, 2012 04:56
om Simple tabs
<div class="om-tabs">
<h3 class="om-tab-heading">tab title</h3>
<div class="om-tab-panel">
<p>Any HTML you want in the panel and any amount of tabs</p>
</div>
<h3 class="om-tab-heading">tab title</h3>
<div class="om-tab-panel">
<p>Any HTML you want in the panel and any amount of tabs</p>
</div>
</div>
@SiTaggart
SiTaggart / gist:2600935
Created May 5, 2012 08:29
Underscore to moustache syntax and useage
<script>
//set underscore to have {{ }} terms
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g,
evaluate: /\{%([\s\S]+?)%\}/g
};
//set variables
var _subscriptionChannels = _.template($('#template').html()),
templateData = {
Owner: 'Channel 10',
@SiTaggart
SiTaggart / git-ff
Created December 18, 2013 01:15 — forked from daveslutzkin/git-ff
#!/bin/bash
# Attempts to fast-forward the current local branch to its remote tracked branch.
# Safely refuses if there is no remote tracking, or if a fast-forward is not possible.
# @author Paul Annesley
if [ -n "$(git merge --ff-only 2>&1 | grep 'unknown option')" ]; then
echo "Your git doesn't seem to support --ff-only... try git 1.7+"
exit 1
fi
@SiTaggart
SiTaggart / git-yesterday
Created January 14, 2014 23:12
Git Yesterday
git config --global alias.yesterday '!git log --graph --all --since="yesterday.midnight" --until="midnight" --author="$(git config user.name)" --oneline'
@SiTaggart
SiTaggart / sass-library-restructure.md
Last active August 29, 2015 14:18
Thoughts on sass-library settings @import structure

Sass-library

Currently we have a problem with $variables and $maps and overriding those at a Pattern-Lab level. Especially if one of those values is dirived by a mixin, using an imported $variable like $fontSizeBase, as the declaration or calculation is based on the value of the dependent variable ($fontSizeBase) at the time it is @import'ed to the mixin, not when the SCSS is compiled.

SASS variables are not references.

//# Defined in sass-library
$fontSizeRoot: 16px;
/* Try to avoid */
.component {
&-parentSelectorSuffix { ... } /* .component-parentSelectorSuffix {} */
.component-childSelector { ... } /* .component .component-childSelector {} */
.notSoObviousParentSelector & { ... } /* .notSoObviousParentSelector .component {} */
}
.componentName__childName__otherChildName__thisIsSillyNow__nopeYouTotallyMissedThePointOfThis--modifier {
…
}
/* The media object as an example */
.media {
@include media;
}
.mediaTable {
@include media("table");
}
/* Avoid styling IDs */
#component { … }
/* Avoid styling descendant elements */
.component h2 { … }
/* Avoid element qualified selectors */
div.component { … }
/* Avoid overly specific rules */