Skip to content

Instantly share code, notes, and snippets.

@timhettler
timhettler / .gitignore
Last active December 27, 2015 17:19
My .gitignore file - covers pretty much everything
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@timhettler
timhettler / utils.scss
Created August 22, 2013 15:09
Some useful utility mixins I reach for on many projects. Compass & Bourbon compatible.
//*
// Makes an element appear circular.
@mixin circular() {
border-radius: 50%;
}
//*
// Disables text selection and the on iOS devices that displays information about a link.
@mixin disable-selection() {
@include user-select(none); //disables text selection
@timhettler
timhettler / SassMeister-input.scss
Created June 25, 2013 20:57
Generated by SassMeister.com, the Sass playground.
// ---
// Sass (v3.2.9)
// ---
%placeholder {
color: red;
}
%placeholder {
@timhettler
timhettler / interactiontypes.js
Last active December 17, 2015 03:28
A quick way to use the appropriate event based on input device
var interactionType = {
click: (Modernizr.touch) ? 'touchend' : 'click',
down: (Modernizr.touch) ? 'touchstart' : 'mousedown',
up: (Modernizr.touch) ? 'touchend' : 'mouseup',
enter: (Modernizr.touch) ? 'touchstart' : 'mouseenter',
leave: (Modernizr.touch) ? 'touchend' : 'mouseleave',
over: (Modernizr.touch) ? 'touchstart' : 'mouseover',
out: (Modernizr.touch) ? 'touchend' : 'mouseout',
move: (Modernizr.touch) ? 'touchmove' : 'mousemove'
};
@timhettler
timhettler / Prism.languages.scss
Last active December 14, 2015 17:19
SCSS language definition for Prism
Prism.languages.scss = {
'comment': {
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
lookbehind: true
},
'keyword': {
pattern: /(\s)(if|in|from|through|and|or|not)(?=\s)/i,
lookbehind: true,
},
'boolean': /\b(true|false)\b/g,
@timhettler
timhettler / dabblet.css
Created October 2, 2012 20:24
Untitled
figure {
box-shadow: 0 18px 5px -18px rgba(0,0,0,.7), 0 12px 8px -12px rgba(0,0,0,.5);
margin: 0 auto;
overflow: hidden;
padding-bottom: 10px;
position: relative;
width: 300px;
}
figure img {
// Original script: http://www.jeffreyharrell.com/blog/2010/11/creating-a-shake-event-in-mobile-safari/
// Thanks to Ben Allman's write-up of jQuery Special Events: http://benalman.com/news/2010/03/jquery-special-events/
// jQuery shake event by Tim Hettler
(function ($) {
$.event.special.shake = {
setup: function ( data, namespaces ) {
@timhettler
timhettler / interview-closure.js
Created July 6, 2012 16:27
"Interview code" that demonstrates knowledge of closures.
for(var i=0;i<10;i++){
(function(i){
setTimeout(function(){console.warn(i)},i*1000);
})(i);
}
@timhettler
timhettler / dabblet.css
Created April 26, 2012 19:03
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
font: bold 15px/1.1 Helvetica;
text-align: center;
}
div {
figure {
box-shadow: 0 18px 5px -18px rgba(0,0,0,.7), 0 12px 8px -12px rgba(0,0,0,.5);
margin: 0 auto;
overflow: hidden;
padding-bottom: 10px;
position: relative;
width: 300px;
}
figure img {