Skip to content

Instantly share code, notes, and snippets.

View joshwhatk's full-sized avatar
📦
outside 💭

Josh Friend joshwhatk

📦
outside 💭
View GitHub Profile
@joshwhatk
joshwhatk / .bash_profile
Last active July 3, 2019 16:00
It's Working! (MacOS)
# It's Working!
function itsworking() {
local currentOutputVolume=$(osascript -e 'set ovol to output volume of (get volume settings)')
local originalVolume=$(expr $currentOutputVolume / 10)
osascript -e 'set Volume 7'
open https://www.youtube.com/embed/AXwGVXD7qEQ?autoplay=true
sleep 7s
osascript -e "set volume ${originalVolume}"
}
@joshwhatk
joshwhatk / RepositoryPatternSimplified.md
Created June 6, 2019 03:01
Repository Pattern Simplified

Repository Pattern (Simplified)

The What

The Repository Pattern is really just creating a layer between your code and a system you are actually depending on so that you can depend solely on your own code.

The Good

One good use-case for a Repository Pattern is within a framework for accessing File Systems.

@joshwhatk
joshwhatk / merge.js
Last active April 17, 2018 20:02
Vanilla $.extend() for merging JS Objects
function merge() {
var newObject = {};
[].slice.call(arguments).forEach(function(argument) {
for (var attrname in argument) { newObject[attrname] = argument[attrname]; }
});
return newObject;
}
/*
|--------------------------------------------------------------------------
| Simply Check for IE (this will not include Edge)
|--------------------------------------------------------------------------
*/
function IECheck() {
if(/*@cc_on!@*/false || !!document.documentMode) {
document.getElementsByTagName('html')[0].classList.add('is-IE');
}
@joshwhatk
joshwhatk / elixir-extensions.js
Last active April 20, 2016 20:26
Compile Angular Views in Laravel Elixir
// Installation
// - Place this file in the same folder as your gulpfile
// - Add this to your gulpfile:
// require('./elixir-extensions');
// - It can be used like this:
// mix.views('views/**/*.html', elixir.config.assetsPath + 'js/compiled', {
// module: 'app',
// root: 'views/'
// });
@joshwhatk
joshwhatk / .bashrc
Last active April 2, 2016 21:42
Scotch Box Provisioning Script
# Better Git log
## Thanks Jeffrey Way
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias html="cd /var/www/"
alias ..="cd ../"
alias ...="cd ../../"
alias ....="cd ../../../"
alias l="ls -al"
alias ll="ls -hal"
@joshwhatk
joshwhatk / .bashrc
Last active April 18, 2019 05:14
Bash
# If Mac
export PATH=/usr/local/mysql/bin:/usr/local:/usr/local/bin:$PATH:~/.composer/vendor/bin:./vendor/bin
# Better Git log
## Thanks Jeffrey Way
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias html="cd /var/www/"
alias ..="cd ../"
alias ...="cd ../../"
@joshwhatk
joshwhatk / bash
Last active February 12, 2017 01:25
Dock defaults modifications (as of Mac OS X 10.12.2)
# Set the dock auto-hide animation to be a much better speed.
defaults write com.apple.dock autohide-time-modifier -float 0.20; killall Dock
@joshwhatk
joshwhatk / Wrench.php
Last active April 27, 2016 21:07
Simple Exception Managing Class (to be used in conjunction with Responsify)
<?php
namespace App\Exceptions;
use Exception;
class Wrench extends Exception
{
//-- Redefine the exception so message isn't optional
public function __construct($code = 500, $message = 'Threw a Wrench in it.', Exception $previous = null)
@joshwhatk
joshwhatk / smoothScroll.js
Last active August 29, 2015 14:19
jwkSmoothScroll (AngularJS smooth scrolling service)
yourApp.factory('jwkSmoothScroll', function jwkSmoothScrollFactory()
{
"use strict";
function jwkSmoothScroll(input_hash, input_duration) {
var hash = input_hash || $location.hash(),
duration = input_duration || 500,
element;