Skip to content

Instantly share code, notes, and snippets.

View peabnuts123's full-sized avatar

Jeff peabnuts123

View GitHub Profile
@peabnuts123
peabnuts123 / components.my-component.js
Last active January 27, 2018 23:41
Tagless Element ES Class
import Ember from 'ember';
export default class MyComponent extends Ember.Component {
constructor() {
super();
// Empty string causes runtime error
// "Assertion Failed: You cannot use `elementId` on a tag-less component"
// Comment this line to fix
this.tagName = '';
@peabnuts123
peabnuts123 / index.html
Created April 14, 2018 03:48
jQuery, SCSS, HTML example
<h1>FOOD CATEGORIES</h1>
<div class="Category">
<div class="Category-header" id="category-1-header">
<h1>Tapas</h1>
</div>
<div class="Category-body" id="category-1-body">
<ul class="is-red">
<li>Olives</li>
<li>Pickles</li>
@peabnuts123
peabnuts123 / benchmark_1.txt
Last active July 31, 2018 05:33
Raspberry Pi Benchmarks
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 4
Doing CPU performance benchmark
Threads started!
Done.
@peabnuts123
peabnuts123 / git-breakdown.sh
Last active August 14, 2018 21:07
Git commit breakdown by author
#!/bin/bash
IFS=$'\n';
output="$(echo "`for author in $(git log | grep "Author:" | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | sort | uniq); do
echo "${author}:|$(git log --pretty=oneline --author=${author} | wc -l | xargs echo) commits";
done`" | sort -n -k2 -r -t '|' | column -t -s '|')";
echo "${output}";
echo "$(git log --pretty=oneline | wc -l) commits total";
@peabnuts123
peabnuts123 / git-prompt.sh
Last active January 14, 2019 02:10
Small function to show local git changes and prompt whether you want to push
# Usage: git-prompt (when in a git repo)
# Print the output of `git status` then prompt the user for whether
# they wish to `git push`
function git-prompt() {
git log "origin/$(git rev-parse --abbrev-ref HEAD)"..HEAD
echo '------------------------------------------';
git status --untracked-files no;
echo '------------------------------------------';
while true; do
@peabnuts123
peabnuts123 / npm-exec.sh
Created December 16, 2018 22:58
run local version of npm commands instead of globally installed
# Add to your ~/.bash_profile
# Usage: npm-exec (command) [...args]
# Execute a command located in an npm bin directory, without
# having to manually path to it
function npm-exec() {
bin="${1}";
shift
args="$*"
"$(npm bin)/${bin}" ${args};
@peabnuts123
peabnuts123 / ls-count.sh
Created May 17, 2019 00:30
Bash utility function for listing the total (recursive) count of files within all subdirectories
# Usage: ls-count (directory=.) (depth=1)
# Perform a recursive find in the specified folder, and display
# a summary of the total number of files in each subfolder
#
# If `directory` is specified, perform search in that directory. Defaults to '.'
# If `depth`is specified, output analysis down to `depth` levels from root. Defaults to 1
# Example usage:
# ls-count
# ls-count ~/Documents
# ls-count ~/Documents/Projects 2
@peabnuts123
peabnuts123 / add-patchnotes-alias.sh
Created July 2, 2019 01:34
Git patch-notes alias, for formatting commits in a patch-notes friendly way
# @NOTE You will need to change column width of User name (currently 20) to match the length of the names
# of the people on your team!!
# Register alias on git:
git config --global alias.patch-notes 'log --pretty="%h %<(20)%an%<(22)%ad %s" --date="format:%m/%d %a %T%t"'
# Usage:
# git patch-notes
# git patch-notes release/2019-05..HEAD
# etc.
@peabnuts123
peabnuts123 / index.html
Created November 14, 2019 22:59
Google maps example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./style.css">
@peabnuts123
peabnuts123 / ls-containers.sh
Created December 13, 2019 03:40
docker ps alias for pretty-printing running containers, with only relevant fields
# Paste into your .bashrc / .bash_profile / .zshrc etc.
alias ls-containers="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.RunningFor}}\t{{.Status}}'"