Skip to content

Instantly share code, notes, and snippets.

View slamkajs's full-sized avatar

Justin Slamka slamkajs

  • Independent
  • PIttsburgh, PA
View GitHub Profile
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@slamkajs
slamkajs / string.color-brightness.js
Created January 4, 2017 19:04
String function that converts a hex value (e.g., #FFFFFF) into a percentage between 0 and 1. The darker the color, the closer the value will be to zero. The lighter the color, the closer the value will be to one.
/**
* HEX TO COLOR TONE
* Convert a hex string for colors into a percentage of color tone
* This function takes accessibility into account when color correcting the brightness differences between RGB
*
* @return float(0, 1)
* black = 0
* white = 1
**/
String.prototype.getColorBrightness = function() {
@slamkajs
slamkajs / string.hex2rgba.js
Created January 4, 2017 19:11
String function that converts a hex value (#FFFFFF) into an rgba value.
/**
* HEX TO RGBA
* Convert a hex string for colors into an rbga value
*
* @param alpha (float) THe opacity value of the color
**/
String.prototype.hexToRgbA = function(alpha) {
var c;
if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(this)){
c= this.substring(1).split('');
@slamkajs
slamkajs / post-merge
Last active January 23, 2017 17:24
Git post-merge hook to automatically update the platforms and plugins used in your cordova project
#!/usr/bin/env bash
# MIT © Justin Slamka <justin.slamka@zapsolutions.com>
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
# GET LIST OF CHANGED FILES
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {