Skip to content

Instantly share code, notes, and snippets.

View dotherightthing's full-sized avatar

Dan Smith dotherightthing

  • Do The Right Thing
  • Wellington, New Zealand
View GitHub Profile
@dotherightthing
dotherightthing / revealing-module-pattern.js
Last active January 8, 2020 11:38
[Revealing module pattern] #js #jsdoc #es5 #trycatch #throw
// some-component.js
// see https://www.youtube.com/watch?v=pOfwp6VlnlM.
/**
* @file Do something
* @author your.name@domain.com
* @requires jquery.js
*/
/**
@wesbos
wesbos / commit-msg
Created July 4, 2016 18:55
ESLint 3.0 Git Pre Commit Hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
for file in ${files}; do
@timothyis
timothyis / gulpfile.babel.js
Last active August 13, 2022 23:36
Gulp 4, ES6 gulpfile example
// Gulp module imports
import {src, dest, watch, parallel, series} from 'gulp';
import del from 'del';
import livereload from 'gulp-livereload';
import sass from 'gulp-sass';
import minifycss from 'gulp-minify-css';
import jade from 'gulp-jade';
import gulpif from 'gulp-if';
import babel from 'gulp-babel';
import yargs from 'yargs';
@jlong
jlong / SassMeister-input.scss
Created February 1, 2014 22:53
Navigate a nested maps with map-fetch() in Sass
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
//
// map-fetch($map, $keys)
//
// An easy way to fetch a deep value in a multi-level map. Works much like
// map-get() except that you pass multiple keys as the second parameter to
@evanshajed
evanshajed / sass-media-breakpoint.scss
Last active December 17, 2015 11:19
@media break point in SASS for standard devices
/*
* By Shajed Evan @evanshajed
* Concept by: CHRIS COYIER @chriscoyier
// Breakpoints
@mixin breakpoint($point) {
/* Smartphones (portrait and landscape) ----------- */
@if $point == sp-portrait-lanscape {
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) { @content; }
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@oslego
oslego / index.html
Created May 28, 2012 15:12
QUnit and Browserscope boilerplate code.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/jquery.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript">
// To save data in Browserscope do something like the following.
// The syntax is 'test_key': 'value' where test_key is some unique
@irae
irae / .jslintrc
Created May 21, 2012 19:22
my jslintrc
{
/*** Globals ***/
// To ignore any custom global variables, enable the `predef` option and list
// your variables within it.
"predef": [
"exports",
"YUITest",
"YUI",
"YUI_config",
"YAHOO",
@btd
btd / jQuery.print.js
Created April 15, 2012 07:25
jQuery.print.js
// Create a jquery plugin that prints the given element.
jQuery.fn.print = function(){
// NOTE: We are trimming the jQuery collection down to the
// first element in the collection.
if (this.size() > 1){
this.eq( 0 ).print();
return;
} else if (!this.size()){
return;
}
@dvessel
dvessel / selectMenu.scpt
Created July 23, 2011 05:25
AppleScript for selecting menu items. Example: selectMenu({"Finder", "file", "new finder window"}) - "Enable access for assistive devices" must be checked in the Universal Access within System Preferences.
-- `selectMenu`, by Jacob Rus, September 2006 modified by Joon Park, 2011
-- Found on http://hints.macworld.com/article.php?story=20060921045743404
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.
--
-- This will return true or false depending on availability and null if the menu
-- item doesn't exist at all. Use `checkMenu` to only check the state.