Skip to content

Instantly share code, notes, and snippets.

View lyzadanger's full-sized avatar

Lyza Gardner lyzadanger

View GitHub Profile
@lyzadanger
lyzadanger / _button-group.scss
Last active August 29, 2015 14:01
Jacket + Custom MQ-handling Mixin
body {
margin: 2em;
}
.button {
background-color: #007dc6;
border-radius: 0.25em;
box-sizing: border-box;
color: #fff;
display: inline-block;
@lyzadanger
lyzadanger / gulp-template-through2.js
Last active August 29, 2015 14:11
Template for gulp plugin using through2
var through = require('through2');
var gutil = require('gulp-util');
// Anything in this scope will execute once on `require`
module.exports = function thisIsMyGulpPlugin() {
// Do some stuff here if you want
// Anything at this scope level will execute once per
// task-level stream (i.e. every time a task is invoked
// and the stream piped through this plugin)
@lyzadanger
lyzadanger / Thinking-points.md
Created March 26, 2015 18:55
Thinking about scope (for Sara)

(You should be able to clone this gist and run node example[x].js for each JS file here to do the exercises).

  • What do you think will happen when you execute example1.js?
  • What happens if you comment out line 12 and run example1.js? Why?
  • What do think will happen when you execute example2.js? Did it work as you expected?
  • What would happen if you added a new line to the end of example3.js and console.log(mySecretValue);? Why?
  • What type is secretKeeper on line 12 of example4.js? How did it get assigned?
  • What code does secretKeeper() execute when it is invoked on line 13 of example4.js? What does it return and how?
  • What type is secret as of line 13 of example4.js?
  • What will log to the console in line 14 of example5.js? Line 15?
@lyzadanger
lyzadanger / deleteEmptyTrees.js
Created May 13, 2015 23:38
Recursive delete all empty directory trees
'use strict';
var walk = require('walkdir');
var fs = require('fs');
var path = require('path');
var extfs = require('extfs');
var deleteEmptyPath = function deleteEmptyPath(delPath, cb) {
extfs.isEmpty(delPath, function (isEmpty) {
if (isEmpty) {
@lyzadanger
lyzadanger / mybreaks.js
Created August 18, 2011 20:03
Slapdash Polyfill for media-query-ish stuff on resize/orientation change
$(document).ready(function() {
$(window).bind('resize orientationchange', function() {
var width = $(this).width();
var height = $(this).height();
var i_am_currently = {};
var breakpoints = [];
breakpoints[0] = {'name' : 'mobile', 'width' : [0, 480]};
breakpoints[1] = {'name' : 'wide', 'width' : [481, 10000]};
@lyzadanger
lyzadanger / blackwatch.css
Created August 23, 2011 18:02
Black Watch Plaid CSS Background (Webkit)
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
@lyzadanger
lyzadanger / blueplaid.css
Created August 23, 2011 18:02
Blue, Yellow, Red Plaid CSS Pattern (Webkit)
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
@lyzadanger
lyzadanger / ios5_label.html
Created October 14, 2011 23:17
jQueryMobile Label Alignment on iOS5
<!DOCTYPE html>
<html>
<head>
<title>The Tartanator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>
</head>
<body>
@lyzadanger
lyzadanger / index.php
Created October 24, 2011 20:33
AppCache demo w/jQuery Mobile & PHP
<!DOCTYPE html>
<html manifest="manifest.appcache.php">
<head>
<title>AppCache Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"></script>
@lyzadanger
lyzadanger / swiper.js
Created December 9, 2011 01:13
Quickie swipe thingy with jQuery
var Swiper = function(el) {
var startX, startY, lastX, lastY;
var minswipe;
var init=function(el) {
Swiper.minswipe = 50;
el.bind('touchstart', function(event) {
Swiper.startX = event.originalEvent.targetTouches[0].screenX;
Swiper.startY = event.originalEvent.targetTouches[0].screenY;
$(this).bind('touchmove', function(event) {
Swiper.lastX = event.originalEvent.targetTouches[0].screenX;