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 / webkit-css-mask.css
Created Jun 25, 2013
CSS: overflow/border-radius mask bug-thingy
View webkit-css-mask.css
/*
* There's a bug in Chrome/Safari using overflow:hidden with border-radius. This mask fixes it.
* Solution: http://stackoverflow.com/questions/5736503/how-to-make-css3-rounded-corners-hide-overflow-in-chrome-opera/10296258#10296258
*/
.masked {
position: absolute;
border-radius: 10px;
overflow: hidden;
/* this fixes the overflow:hidden in Chrome */
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
@adamcbrewer
adamcbrewer / cloudSettings
Last active Jul 18, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-07-18T15:26:12.562Z","extensionVersion":"v3.4.0"}
@adamcbrewer
adamcbrewer / getRotationDegrees.js
Created Dec 4, 2012
JS: CSS transform-martrix to rotation in degrees
View getRotationDegrees.js
/**
* Returns rotation in degrees when obtaining transform-styles using javascript
* http://stackoverflow.com/questions/8270612/get-element-moz-transformrotate-value-in-jquery
*/
function getRotationDegrees(obj) {
var matrix = obj.css("-webkit-transform") ||
obj.css("-moz-transform") ||
obj.css("-ms-transform") ||
obj.css("-o-transform") ||
obj.css("transform");
@adamcbrewer
adamcbrewer / node.sh
Created Jul 23, 2013
NODE: Run a daemon node.js server and create virtualhost to forward all site traffic to the specified port.
View node.sh
# This command will make sure the process persists
# even after you log out of a session
node server.js >/dev/null 2>&1 &
@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 / queryToObject.js
Created Mar 20, 2013
JS: Query string to object
View queryToObject.js
/**
* Converts a URL query string to a javascript object
*
* @author Adam Brewer - @adamcbrewer - adamcbrewer.com
*
* Usage: "?test=true&something=false".queryToObj(?);
*
* Output: {test: true, something: false}
*
*/
@adamcbrewer
adamcbrewer / css-sass-helpers.scss
Last active Aug 2, 2018
SASS: Helpers and mixins for using with SASS
View css-sass-helpers.scss
//============================================================
// Typography
//============================================================
// An rem font-size mixin providing fallback to px
@mixin font-size($sizeValue: 1.4) {
$remValue: $sizeValue;
$pxValue: ($sizeValue * 10);
font-size: #{$pxValue}px;
font-size: #{$remValue}rem;
@adamcbrewer
adamcbrewer / custom_shortcodes.php
Created Mar 14, 2012
WP: Adding Shortcodes To Use When Posting
View custom_shortcodes.php
<?php
/**
* Adding shortcodes to the post-editing section: functions.php
* http://net.tutsplus.com/tutorials/wordpress/wordpress-shortcodes-the-right-way/
*
**/
/**
@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 / 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.