Skip to content

Instantly share code, notes, and snippets.

View pixelbacon's full-sized avatar

Michael Minor pixelbacon

View GitHub Profile
@pixelbacon
pixelbacon / Bootstrap3-breakpoints.scss
Last active May 31, 2017 04:52
Sass + Breakpoint + Bootstrap 3 Variables
/**
Matches Bootstrap 3
*/
$bp-xs : max-width 767px; // Mobile
$bp-sm : 768px 991px; // Tablet - Portrait
$bp-md : 992px 1199px; // Tablet - Landscape
$bp-lg : min-width 1200px; // Desktop
/**
By Device Name/BS3
@pixelbacon
pixelbacon / sass-simple-columns.scss
Last active August 29, 2015 14:06
Simple columns in Sass
@mixin set-columns($numCols, $margin:0, $padding-sides:0) {
$afterPadding: 100% - (($numCols - 1) * $margin);
float: left;
width: $afterPadding/$numCols;
margin-right: $margin;
padding-left: $padding-sides/2;
padding-right: $padding-sides/2;
&:nth-of-type(#{$numCols}n + #{$numCols}) {
@pixelbacon
pixelbacon / base64FileDecode.php
Last active January 10, 2017 17:20
Decode json base64 file string.
<?php
/**
* Takes a base64 encoded file string and returns usable information, including the re-encoded file.
* Very useful for absorbing files over JSON.
* @param $str
* @return array
* @throws Exception
*/
function base64FileDecode($str)
@pixelbacon
pixelbacon / passport-FB-Twitter-Google.js
Last active May 27, 2017 19:29
Simple Passport-Facebook, Passport-Twitter, Passport-Google redirect based on role
var express = require('express')
, router = express.Router()
, passport = require('passport');
var loginUrl = '/#/auth/login'
, redirectUrl = '/auth/redirect/'
, loggedInUrl = '/#/account'
, logoutRedirect = '/';
// Logout
@pixelbacon
pixelbacon / MomentJS-iteration.js
Last active May 24, 2021 08:44
MomentJS iterate through daily start/end, check for clashes
var moment = require('moment'); // http://momentjs.com/docs/
var _ = require('lodash'); // https://lodash.com/docs
function(collectionsWithDateValues){
var slots = [];
var hours = {
start: 7, // 7am
end: 21, // 9pm
window: 2 // How long each item should be slotted for.
};
@pixelbacon
pixelbacon / .bash_profile
Last active September 4, 2015 18:00
~/.bash_profile
# Alias Vagrant
alias v='vagrant'
# Quick outward IP
alias myip='curl ip.appspot.com'
# DNS Flush
alias flushDNS='sudo discoveryutil udnsflushcaches' # 10.10
# alias flushDNS='dscacheutil -flushcache; sudo killall -HUP mDNSResponder' # 10.9
# alias flushDNS='sudo killall -HUP mDNSResponder' # 10.7 – 10.8
@pixelbacon
pixelbacon / ExportPSDFolderToPNG.jsx
Last active December 12, 2019 22:59
Export folder of AI, PNG, or PSD files to PNG w/ transparency
// Source: https://gist.github.com/pixelbacon/7754cba64125b0240504
// Inspired by:
// https://github.com/jonahvsweb/Photoshop-Automated-Resize-to-Web.jsx
// http://blog.wp.weightpoint.se/2012/02/02/batch-export-photoshop-psd-files-to-png-the-right-way/
// To use open Script via Photoshop OR File > Scripts > Browse
#target "photoshop"
// Source: https://gist.github.com/pixelbacon/7754cba64125b0240504
// Inspired by:
// https://github.com/jonahvsweb/Photoshop-Automated-Resize-to-Web.jsx
// http://blog.wp.weightpoint.se/2012/02/02/batch-export-photoshop-psd-files-to-png-the-right-way/
`
// To use open Script via Photoshop OR File > Scripts > Browse
#target "photoshop"
@pixelbacon
pixelbacon / squarespaceBreakpoints.less
Last active January 24, 2024 09:32
Squarespace Breakpoints.
/**
Squarespace essentially doesn't really document their breakpoints.
This can be quite annoying to not have when doing custom CSS.
Most themes use essentially one breakpoint. Mobile and not mobile; anything 750 and below is considered mobile.
You can use these to write your own CSS and simply use the "Style Editor" to inject your compiled CSS in the event
you are not using "Developer Mode" in your site.
Enjoy!
@pixelbacon
pixelbacon / divshotPushPublish.sh
Last active September 3, 2015 22:08
Divshot.io Push & Publish alias
# When using Divshot.io as a compliment to things like SS for holding your CSS and JS,
# you want to push something you already tested locally and publish without typing in
# multiple commands.
#
# At least I do. So I wrote this alias and put it in my `~/.bash_profile`.
# I'm not really going to document it's use because if you see it and don't know what
# it does, then there is a good chance you shouldn't be using it.
#
# Misuse can very easily put you in a bad spot.
alias dpush="divshot push; divshot promote development staging; divshot promote staging production;"