Skip to content

Instantly share code, notes, and snippets.

View grahamlicence's full-sized avatar

Graham Licence grahamlicence

  • 101 Ways
  • London
View GitHub Profile
@grahamlicence
grahamlicence / animationend.js
Created June 23, 2014 14:19
Listening for animationend event cross browser (vanilla JavaScript)
var btn = document.querySelectorAll('button')[0],
animatedElement = document.querySelectorAll('.animated-element')[0],
animationEndEvent = null; // use this to check for support and trigger fallback
// feature detect which vendor prefix is used
(function getAnimationEventName () {
var testEl = document.createElement('div'),
transEndEventNames = {
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'animationend',
@grahamlicence
grahamlicence / disqus.html
Created March 17, 2016 11:14
Load Disqus comments on click
<button class="disqus-button">View comments</button>
<div id="disqus_thread"></div>
<script async="true">
var disqus_config = function () {
this.page.url = YOUR_PAGE_URL;
this.page.identifier = YOUR_PAGE_IDENTIFIER;
},
button = document.getElementsByClassName('disqus-button')[0],
loadDisqus = function(e) {
e.preventDefault();
{
"font_size": 9,
"ignored_packages":
[
"Vintage"
],
"translate_tabs_to_spaces": true,
"tab_size": 4
}
iframe {
max-width: 100%;
}
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
]
/***
BASE STYLESHEET
The purpose of this style sheet is to provide a complete reset of styles and provide a few basic classes.
This stylesheet should be included on all pages (even if they drift from a standard template) and, as such,
does not contain any styles for the branding or layout. Branding and layout styles can be found in Generic.css.
@Authors
@grahamlicence
grahamlicence / _retina.scss
Last active December 22, 2015 15:58
Retina Sass
/* mixin for retina background images */
@mixin background-image-retina($file, $type, $width, $height) {
width: $width+px;
height: $height+px;
background-image: image-url($file + '.' + $type);
background-repeat: no-repeat;
background-position: 0% 50%;
text-indent: -9999px;
overflow: hidden;
text-align: left;
@grahamlicence
grahamlicence / placeholder.css
Created March 25, 2013 12:08
Style placeholder text differently from input text
/*
article: http://blog.grahamlicence.co.uk/post/Styling-input-placeholder-CSS-to-differ-from-input.aspx
Note, when adding these styles they must be implemented seperately as the following not work in either browsers
*/
/* Chrome */
input::-webkit-input-placeholder {
font-style: italic;
}
@grahamlicence
grahamlicence / setup.md
Last active November 6, 2015 14:12
Machine setup

##Mac show hidden files

defaults write com.apple.finder AppleShowAllFiles YES

change git text editor

git config --global core.editor "nano"
Sublime Text Packages
A few recommended packages:
“DocBlockr"
Allows you to easily write comments in the format:
/**
*
*/
“EditorConfig"