Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Blumed's full-sized avatar

Cullan Blumed

View GitHub Profile
@Blumed
Blumed / datetime-decimal-format.js
Last active April 12, 2024 23:27
Bookmarklet for right now time in this 2024.04.12.15.25 format
/*
Raw Code
*/
try {
const rightNow = new Intl.DateTimeFormat("en-US", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
@Blumed
Blumed / .zshrc
Last active April 6, 2024 19:04
Simple bash function for opening any repo in your git project directory using any editor.
openWork() {
StartColor="\e[1;32m"
EndColor="\e[0m"
editor="code" # add command which opens files/dirs using your editor
workDirectory=(~/dev/) # add your path to your work directory
directories=($workDirectory*)
PS3="Enter the number associated with a directory you want to open with $editor? "
echo "There are ${StartColor}${#directories[@]}${EndColor} directories in ${StartColor}${workDirectory}${EndColor}:"; \
select directory in "${directories[@]##*/}"; do echo "Opening ${StartColor}${directory}${EndColor}"' with '${StartColor}${editor}${EndColor}'!'; $editor $workDirectory${directory}; break; done
}
@Blumed
Blumed / bs-breaks.sh
Created April 24, 2018 19:24
Quickly print bootstrap 3 common grid numbers to terminal by running this script
#!/bin/bash
echo "
$(tput bold)$(tput smul)Bootstrap $(tput setaf 6)V3.3.7$(tput sgr0)
$(tput setaf 7)$(tput bold)Grid$(tput sgr0)
$(tput setaf 7)\$$(tput setaf 5)screen-xs-min $(tput setaf 7)= $(tput setaf 6)0
$(tput setaf 7)\$$(tput setaf 5)screen-xs-max $(tput setaf 7)= $(tput setaf 6)767px
$(tput setaf 7)\$$(tput setaf 5)screen-sm-min $(tput setaf 7)= $(tput setaf 6)768px
@Blumed
Blumed / osx_bootstrap.sh
Last active November 10, 2017 14:54 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
@Blumed
Blumed / dynamicPreventDefault.js
Created June 22, 2017 14:44
Handy way to prevent default by adding logic to a click with # in href
$('a').on('click', function(e) {
if($(this).attr('href') === '#') {
e.preventDefault();
}
});
@Blumed
Blumed / url-query-parser.js
Last active April 18, 2017 04:56
Create a query directory object out of a url.
//https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript?page=1&tab=active#tab-top
let qd = {};
if (location.href) {
let re = /(\#|\&)/;
location.href.substr(1).split(re).forEach(item => {let [k,v] = item.split("="); v = v && decodeURIComponent(v).replace(/\+/g, " "); (qd[k] = qd[k] || []).push(v)})
}
//type qd into console to see all of the arrays created by script
@Blumed
Blumed / .inputrc
Created April 5, 2017 13:38
Script allows you to search history for a particular process or app instead of the entire line.
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@Blumed
Blumed / filelist.sh
Last active March 26, 2017 00:47
A bash function that takes file extensions as arguments. You may pass as many as you want and output each file name matching your extension into a file so you can copy and past from it quickly or share your custom file list
filelist() {
if [ $# -gt 0 ]; then
shopt -s nullglob
for ext in "$@"; do
printf '%s\n' *.$ext
done | pbcopy
echo "copied listing for $@ files to clipboard"
else
shopt -s nullglob
@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 / 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": [