Skip to content

Instantly share code, notes, and snippets.

Adam Brewer adamcbrewer

Block or report user

Report or block adamcbrewer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adamcbrewer
adamcbrewer / cloudSettings
Last active Sep 13, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-09-13T16:42:44.694Z","extensionVersion":"v3.4.2"}
@adamcbrewer
adamcbrewer / actions.js
Last active Nov 17, 2016
JS: React & Redux Component Kit
View actions.js
export const ACTION_KEY = 'ACTION_KEY';
// If a component has this method defined in `bindActionCrators`
// then this method can be called via `this.props.actionsFunction()`
// within the component.
export function actionFunction(value) {
return {
type: ACTION_KEY,
payload: value
};
@adamcbrewer
adamcbrewer / entities.json
Created Oct 12, 2015
JSON: HTML Entity Reference
View entities.json
{
"ascii": [
{
"character": " ",
"entityName": " ",
"entityNumber": " ",
"description": "Space"
},
{
"character": "!",
@adamcbrewer
adamcbrewer / viewbox-trim.js
Last active Mar 27, 2019
JS: Trim SVG viewbox
View viewbox-trim.js
/**
* Will trim the whitespace around the SVG's viewbox
*
*/
var svg = document.getElementsByTagName("svg")[0];
var bbox = svg.getBBox();
var viewBox = [bbox.x, bbox.y, bbox.width, bbox.height].join(" ");
svg.setAttribute("viewBox", viewBox);
@adamcbrewer
adamcbrewer / share-intents.md
Last active Nov 9, 2017
SOCIAL: Share intents on major platforms
View share-intents.md

Twitter

<a href="http://twitter.com/intent/tweet?url={url_encoded_url}&amp;text={url_encoded_text}&amp;hashtags={url_encoded_hashtags}">Tweet This</a>

Tumblr

<a href="http://www.tumblr.com/share/link?url={url_encoded_url}&amp;name={url_encoded_post_title}&amp;description={url_encoded_post_text}">Share on Tumblr</a>
@adamcbrewer
adamcbrewer / typo-transforms.css
Created May 22, 2014
CSS: Fixing Typography Inside of CSS 2D Transforms
View typo-transforms.css
/* This should hopefully fix crappy typography inside of rotated elements.
Taken from http://flippinawesome.org/2014/05/21/fixing-typography-inside-of-css-2-d-transforms/ */
.rotated-typography {
transform: perspective(1px) rotate(-10deg);
/* Using `translateZ(0)` forces GPU rendering (and only fixes -webkit), but `perspective(1px)` does the job nicely. */
/* Don't use -ms prefix, however, as Presto engine in IE9 lacks 3D transform support. */
}
@adamcbrewer
adamcbrewer / sortBy.onEdit.gs
Created Feb 1, 2014
GS: Automatically sorts the 1st column (not the header row) Ascending.
View sortBy.onEdit.gs
/**
* Automatically sorts the 1st column (not the header row) Ascending.
*/
function onEdit(event){
var sheet = event.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
var columnToSortBy = 1;
var tableRange = "A4:Z99"; // What to sort.
@adamcbrewer
adamcbrewer / hd-media-query.css
Created Jan 18, 2014
CSS: HD Media Query Snippet
View hd-media-query.css
@media (-webkit-min-device-pixel-ratio: 2),
(min--moz-min-device-pixel-ratio: 2),
(min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background-image: url(../img/logo@2x.png);
}
}
@adamcbrewer
adamcbrewer / interval.js
Created Nov 21, 2013
JS: A better interval handler
View interval.js
/**
* setInterval has some issues:
* 1. Doesn't care whether the callback is still running or not
* 2. Ignores errors
*
* @source http://www.thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
* @param func The function to call
* @param wait The interval to wait
* @param times The total number of repititions, instead of infinite
*
@adamcbrewer
adamcbrewer / totype.js
Created Nov 21, 2013
JS: A Better typeof operator
View totype.js
/**
* A better, more reliable way to handle `typeof` checking.
*
* @source http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/
*
*/
Object.toType = function(obj) {
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
}
You can’t perform that action at this time.