Skip to content

Instantly share code, notes, and snippets.

View fileTocGenerator.js
const _ = require('lodash');
const getFilesFromDir = require('./getFilesFromDir.js');
const fs = require('fs');
module.exports = fileTocGenerator;
function getMarkdownStack(obj, stack = [], lvl = 0) {
const filesObj = obj.files;
if (filesObj) {
for (var property in filesObj) {
@tommycoppers
tommycoppers / sass-map-functions.scss
Last active Aug 29, 2015
Map Functions - To add support to native List and Map functions in Sass
View sass-map-functions.scss
// ========================================
// ===== Collections (Maps and Lists) =====
// ========================================
// ------------------------------------------------
// Create and return a new list between a start and end point within provided list
//
// @param {List} $list - List to slice
@tommycoppers
tommycoppers / carousel.js
Last active Aug 29, 2015
Touch ready carousel/slider
View carousel.js
View modal.js
;(function($, window, document, namespace){
var modalData = 'modal';
$.fn.modal = function(options) {
return this.each(function() {
if (!$(this).data(modalData)) {
$(this).data(modalData, new Modal(this, options));
}
});
};
View EasterEgg.js
;(function easterEgg ($, namespace) {
function EasterEgg (options) {
var defaults = {
timeout : 2000, // Time you have to enter a new key before the keysPressed array gets flushed
logKeys : false, // Console log the keys that you are pressing. Helps to determine combos.
combos : [] // [[keys], callback] - Add the combos from the start here. OR, add them with a returned function after the fact
};
View KeyCombo.js
;(function keycombo ($, namespace) {
function KeyCombo () {
var eventNamespace, // Unique namespace so that keypressing can be unbound
keysPressed = [], // Dynamically populates with key codes as they are actviely pressed
combos = []; // [[keys], callback]
var $document = $(document);
// Private Functions
////////////////////
@tommycoppers
tommycoppers / _sass-columns.scss
Last active Aug 29, 2015
Creating % Based Columns mapped to Breakpoints
View _sass-columns.scss
// ------------------------------------------------
// Creating % Based Columns.
//
// @param {Map} $breakpoints - Mapping of breakpoint to # of columns
// @param {Number} $breakpoint-override - When mixin is included within a breakpoint
// @param {Number} $gutter - Provies spacing between the columns
//
// @requires Must be included on the parent of the 'columns'.
// 'columns' is dependent on breakpoint() ** https://gist.github.com/tommycoppers/06f71cf07686836395b9
View _sass-grid.scss
// ==========================================
// ================== Grid ==================
// ==========================================
// --- Introduction ---
//
// Sass generated, semantic, percent-based grid system, so you don't have to!
// This Sass Partial takes in the configurable settings and will create a grid framework without redundant code.
// The naming conventions follow the BEM CSS pattern.
// Control the width of the Column by a modifier class, configured into a reduced fraction.
View pubsub.js
// pubsub - https://github.com/cowboy/jquery-tiny-pubsub
;(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
};
$.unsubscribe = function() {
o.off.apply(o, arguments);
};
@tommycoppers
tommycoppers / _sass-breakpoints.scss
Last active Aug 29, 2015
Breakpoints With Unit testing!
View _sass-breakpoints.scss
// ==================================================
// =================== Breakpoints ==================
// ==================================================
//
// --- Introduction ---
//
// Media Queries, namely Breakpoints, are key in responsive design / development.
// "breakpoint" allows for a robust approach to rapid development of Media Queries in your CSS.
// By defining a list of approved breakpoints, this library helps to ensure consistent Media Query output, relative to each project.
// In addition to defined breakpoints, you are allowed to pass in numbers of measure ( width of screen ) to fine tune one-off cases.