Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tommycoppers's full-sized avatar

tommycoppers

  • Bambee
View GitHub Profile
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 August 29, 2015 14:13
Map Functions - To add support to native List and Map functions in Sass
// ========================================
// ===== 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 August 29, 2015 14:06
Touch ready carousel/slider
;(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));
}
});
};
;(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
};
;(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 August 29, 2015 14:05
Creating % Based Columns mapped to Breakpoints
// ------------------------------------------------
// 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
// ==========================================
// ================== 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.
// 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 August 29, 2015 13:57
Breakpoints With Unit testing!
// ==================================================
// =================== 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.