Skip to content

Instantly share code, notes, and snippets.

View Blumed's full-sized avatar

Cullan Blumed

View GitHub Profile
@Blumed
Blumed / .bash_profile
Created January 8, 2016 02:30
Imagemagick: resize / convert to png or jpg / change png background color / send it somewhere
# resize / convert to png / send it somewhere
#
# function file size quality whereTo
# resizepng \*\.\* 300 82 img-full/
#
resizepng() {
mogrify -format png -path $4 -filter Triangle -define filter:support=2 -thumbnail $2 -dither None -quality $3 -unsharp 0.25x0.08+8.3+0.045 -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB $1
}
# resize / convert to png / fill transparency with a color / send it somewhere
@Blumed
Blumed / bash.sh
Last active February 1, 2016 21:48
Dependencies: imagemagick The idea here is that you have a folder with uncompressed images that use two identifiers in the filename. Using imagmick compressing and converting .png's to .jpg's will move them over to the compressed folder. The two filename identifires are Size "thumb, md, lg" and Retina "noneretina, 2x". If you're using awesome sc…
#!/bin/bash
#---------------------------------------------#
#
# VARIABLES
#
BGCOLOR="#f6f6f6" #Background color to use when flattening transparent areas of png
thumbnail='185' #Thumbnail image width
medium='650' #Medium image width
large='1000' #Large image width
@Blumed
Blumed / social.sh
Last active January 19, 2016 08:40
Use gulp, and jekyll? me too. I made a handy an automated process for social post images.
#!/bin/bash
cd src/assets/images/social/uncompressed #change directory to exicute script in uncompressed folder
mkdir .tmp #making temp derectory
cp * .tmp/
mogrify -format jpg -filter Triangle -define filter:support=2 -thumbnail 1200x630! -quality 100 -unsharp 0.25x0.08+8.3+0.045 -dither None -define jpeg:fancy-upsampling=off -interlace none -colorspace sRGB -path .tmp/ .tmp/*.*
mv .tmp/*.jpg .tmp/../../og/; rm -R .tmp/*;
cp * .tmp/
@Blumed
Blumed / regexSvg.sh
Last active February 8, 2016 21:39
Regex Svg Cleaning
# In sublime text must turn on regex and case sensativity.
#Grabs all attributes that start with sketch until last second qoute.
\ssketch.[^"]*(["'])(?:(?=(\\?))\2.)*?\1
#Grabs all attributes that start with font-weight until last second qoute.
\sfont-w.[^"]*(["'])(?:(?=(\\?))\2.)*?\1
#Grabs def,desc,title,svg tags and comments
(?=(<def)|(<desc)|(<title)|(<\!)|(<svg)|(<\/svg)|(<\?)).+
@Blumed
Blumed / inline-dividers.scss
Last active January 24, 2017 13:31
CSS: Inline links/text with dividers
//Inline Divides
//------------------------
.is-inline {
font-size: 0;
}
.is-inline > * {
display: inline-block;
position: relative;
}
@Blumed
Blumed / user-pref.sh
Last active January 24, 2017 13:38
Bash: Create a centralized Sublime Text User Preference
#-----------------------------------------------------
# Sublime Text 3 - Syncing User Prefrences
#-----------------------------------------------------
#Put these snippets inside your .bash_profile
#Call this snippet on your first computer
sublimeOrigin() {
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
mkdir ~/Dropbox/Sublime
@Blumed
Blumed / base64.sh
Last active March 15, 2017 15:08
Bash: Base64 CLI
#Original Script found here @puppybits https://gist.github.com/puppybits/1565441
# Example
# bas64 file.png creates the string with the needed data:image/png;base64, appended to the front of the string and copies it to your clipboard
# bas64 file.png -img does the same as above but adds an image tag around the string so all you need to do is paste into your html file
bas64(){
filename=$(basename $1)
ext=${filename##*.}
if [ $ext == gif ]; then
append="data:image/gif;base64,";
elif [ $ext == jpeg ] || [ $ext == jpg ]; then
@Blumed
Blumed / 0_reuse_code.js
Created August 2, 2016 15:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Blumed
Blumed / snippets.dash
Last active January 29, 2017 17:38
Dash: Snippets
//-------------------------------
// Meeting formatting for Harvest
//-------------------------------
bld`
@cursor__JRIA TICKET/STORY NAME__ [bld]: __Development task as apart of your sprint__
int`
@cursor__JRIA TICKET/STORY NAME__ [int]: __Development task required to support the backend team__
@Blumed
Blumed / scss.json
Created March 6, 2017 06:31
Visual Studio Code Snippet - Bootstrap3 Media Query
"BS3 Media Query Snippet": {
"prefix": "bs-media",
"body": [
"@media ($minMax-width: \\$screen-$xsSmMdLg-$minMax) {\n\t$0\n}"
],
"description": "BS3 MediaQuery"
},
"BS3 Media Query Self Only Snippet ": {
"prefix": "bs-media-only",
"body": [