Skip to content

Instantly share code, notes, and snippets.

View taivu's full-sized avatar

Tai taivu

View GitHub Profile
@taivu
taivu / commit-msg
Last active January 3, 2019 19:15
Git Hook: Commit Msg
#!/usr/bin/env bash
# set this to your active development branch
#develop_branch="develop"
#current_branch="$(git rev-parse --abbrev-ref HEAD)"
# only check commit messages on main development branch
#[ "$current_branch" != "$develop_branch" ] && exit 0
# regex to validate in commit msg
@taivu
taivu / _mixins.scss
Created September 11, 2018 18:48
SCSS Boilers
/* ==========================================================================
Mixins
========================================================================== */
// Media Queries
// Usage:
// @include breakpoint($large) { };
// @include breakpoint(400px, min-height) { };
$media-feature: 'min-width' !default;
@mixin bp($point, $feature: $media-feature) {
@taivu
taivu / multiFilter.js
Created August 24, 2018 13:34 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple criteria.
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria
@taivu
taivu / .bash_aliases
Created June 27, 2018 19:25
Git: Remove Merged Branches from Remote
remove-merged-branches () {
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
// Note: This only works as is, if you are using typekit's JS
@mixin fout($transitionAxis: none) {
transition: all .25s ease;
opacity: 1;
.wf-loading & {
opacity: 0;
}
@taivu
taivu / brew_symlink_error_sierra.md
Created May 11, 2018 13:55 — forked from dalegaspi/brew_symlink_error_sierra.md
Homebrew Symlink errors in Mac OSX High Sierra
@taivu
taivu / _critical.scss
Created May 11, 2018 01:09 — forked from benedfit/_critical.scss
Critical CSS using Sass and Jekyll
$critical-css-only:true !default;
@mixin critical($critical-only:true){
@if (($critical-css-only and $critical-only) or (not $critical-css-only and not $critical-only)){
@content;
}
}
@taivu
taivu / fix-homebrew-npm.md
Created April 19, 2018 17:42 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

export function parseName(path) {
const name = path.toLowerCase()
// Remove starting ./
.replace(/^\.\//, '')
// Parameters
.replace(/\/_(\w+)(\/|\.vue$)/, '/:$1/')
// Remove file extension and 'index'
.replace(/(index)?\.vue$/, '')
// Remove trailing '/'
.replace(/\/$/, '');
@taivu
taivu / fix_github_https_repo.sh
Created January 24, 2018 18:23 — forked from m14t/fix_github_https_repo.sh
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi