Skip to content

Instantly share code, notes, and snippets.

View tylerbuchea's full-sized avatar
💭
Hello World!

Tyler tylerbuchea

💭
Hello World!
View GitHub Profile
@tylerbuchea
tylerbuchea / JSKeyCodes
Created December 17, 2013 19:58
List of JavaScript key codes.
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@tylerbuchea
tylerbuchea / style.css
Last active August 29, 2015 14:09 — forked from mwbrooks/style.css
* {
-webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */
-webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */
}
/**
* @providesModule TappyButtonApp
* @flow
*/
'use strict';
var React = require('react-native/addons');
var {
Bundler,
StyleSheet,
@tylerbuchea
tylerbuchea / gist:5bf40927a3af789f8843
Created March 15, 2015 01:35
generator-angular-gulp html5mode modrewrite
$ npm install --save-dev connect-modrewrite
Then edit gulp/server.js
var modRewrite = require('connect-modrewrite');
function browserSyncInit(baseDir, files, browser) {
browser = browser === undefined ? 'default' : browser;
browserSync.instance = browserSync.init(files, {
startPath: '/index.html',
= IMAGEMAGICK
Working with images, PDFs and the command line
# convert from one format to another
convert image.gif image.jpg
# convert specific PDF page to image
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@tylerbuchea
tylerbuchea / optimizedScroll.js
Created July 29, 2015 22:39
The JavaScript scroll event isn't very peformant this MDN snippet fixes that with a modified event.
(function() {
'use strict';
var throttle = function(type, name, obj) {
obj = obj || window;
var running = false;
var func = function() {
if (running) { return; }
running = true;
obj.requestAnimationFrame(function() {
obj.dispatchEvent(new CustomEvent(name));
@tylerbuchea
tylerbuchea / svg2png.js
Last active August 29, 2015 14:26 — forked from gustavohenke/svg2png.js
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@tylerbuchea
tylerbuchea / pubsub-simple.js
Last active August 29, 2015 14:27 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,