Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘
Doing things.

Kyle Brumm kjbrum

🤘
Doing things.
View GitHub Profile
@kjbrum
kjbrum / groupBy.js
Created Apr 13, 2021
Group an array of object by a specified key
View groupBy.js
/**
* Group an array of object by a specified key
* @param {array} items Array of objects
* @param {string} key Key to use for grouping
* @returns {object}
*/
const groupBy = (items, key) => {
return items.reduce(
(result, item) => ({
...result,
@kjbrum
kjbrum / README.md
Last active Apr 27, 2020
Scripts for removing popups
View README.md
View youtube-vimeo-parser.js
// Credit: https://gist.github.com/yangshun/9892961
const video = {
parse: function(url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
@kjbrum
kjbrum / Sass Helpers
Last active Feb 20, 2020
Helper files for writing Sass.
View Sass Helpers
# Sass Helpers
- Variables
- Functions
- Mixins
@kjbrum
kjbrum / Base.js
Last active Aug 28, 2020
React primitive components using styled-system.
View Base.js
import React, { forwardRef } from 'react'
import styled from 'styled-components'
import css, { get } from '@styled-system/css'
import {
system,
compose,
space,
color,
typography,
layout,
@kjbrum
kjbrum / dev-environment-setup.md
Last active Jul 9, 2019
Quick steps for getting your local dev environment up and running.
View dev-environment-setup.md

Dev Environment Setup

Be sure to follow these steps in order, or you might run into unexpected issues.

Xcode

# When asked about the command line tools, hit install.
xcode-select --install
@kjbrum
kjbrum / browserdetect.js
Last active Nov 17, 2020
Detect the current browser and version using the user agent.
View browserdetect.js
/**
* browserdetect.js
* Detect the current browser and version using the user agent.
* Credit: https://stackoverflow.com/a/13480430/6272119
*/
var BrowserDetect = {
dataBrowser: [
{ string: navigator.userAgent, subString: "Edge", identity: "MS Edge" },
{ string: navigator.userAgent, subString: "MSIE", identity: "Explorer" },
{ string: navigator.userAgent, subString: "Trident", identity: "Explorer" },
@kjbrum
kjbrum / reinstall-mysql.md
Last active Dec 5, 2020
Completely remove MySQL and reinstall.
View reinstall-mysql.md
@kjbrum
kjbrum / r_strip_tags_array.php
Last active May 8, 2018
Strip tags from an array
View r_strip_tags_array.php
<?php
/**
* Strip tags from an array.
*
* @param array $arr The array to remove tags from
* @return array The new array without tags
*/
function r_strip_tags_array( $arr ) {
if( ! is_array( $arr ) ) return $arr;
@kjbrum
kjbrum / php-switcher.sh
Last active Mar 21, 2018
Easily switch between PHP versions with Homebrew and Laravel Valet.
View php-switcher.sh
#!/usr/bin/env bash
# PHP Switcher
# Easily switch between PHP versions with Homebrew and Laravel Valet.
# Copyright (C) Kyle Brumm <http://kylebrumm.com>
#
# Credit/Resources:
# https://gist.github.com/bgarrant/b9a2f7fb8ff06c9a45086359ded7a95e
# https://raw.githubusercontent.com/conradkleinespel/sphp-osx/master/sphp