This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print Git commit statistics for a specific author | |
# Usage: git-stats "Linus Torvalds" | |
git-stats() { | |
author=${1-`git config --get user.name`} | |
echo "Commit stats for \033[1;37m$author\033[0m:" | |
git log --shortstat --author $author -i 2> /dev/null \ | |
| grep -E 'files? changed' \ | |
| awk 'BEGIN{commits=0;inserted=0;deleted=0} \ | |
{commits+=1; if($5!~"^insertion") { deleted+=$4 } \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stop script on error signal | |
set -e | |
# remove old deployment folders | |
if [ -d "/home/forge/deploy" ]; then | |
rm -R /home/forge/deploy | |
fi | |
if [ -d "/home/forge/backup" ]; then | |
rm -R /home/forge/backup | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeDistantApiGateway { | |
public function __construct($apiKey) { | |
$this->apiKey = $apiKey; | |
} | |
public function getSomeData() { | |
// whatever API request over guzzle or something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeDistantApiGateway { | |
public function __construct($apiKey) { | |
$this->apiKey = $apiKey; | |
} | |
public function getSomeData() { | |
// whatever API request over guzzle or something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Auto-reload config | |
function reloadConfig(files) | |
doReload = false | |
for _,file in pairs(files) do | |
if file:sub(-4) == ".lua" then | |
doReload = true | |
end | |
end | |
if doReload then | |
hs.reload() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Auto-reload config | |
function reloadConfig(files) | |
doReload = false | |
for _,file in pairs(files) do | |
if file:sub(-4) == ".lua" then | |
doReload = true | |
end | |
end | |
if doReload then | |
hs.reload() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
installation: put this file in ~/.hammerspoon and add this line to your init.lua: | |
local cheaphints = require "cheaphints" | |
usage: by default, just hit cmd+alt+E. you'll see a list of keys and associated | |
windows. if you hit escape, you'll exit hint mode. if you hit one of the keys in | |
the list, that window gets focused. the hint mode will exit automatically after | |
a while. | |
]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local workApplications = { 'Mail','HipChat','PhpStorm','Safari','Charles'} | |
local workApplicationWatcher; | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() | |
hs.notify.new({title="Hammerspoon", informativeText="Setting home layout"}):send() | |
local homeMonitor = "LG ULTRAWIDE" | |
local windowLayout = { | |
{"PhpStorm", nil, homeMonitor, {x=0, y=0, w=0.6, h=1}, nil, nil}, | |
{"Charles", nil, homeMonitor, {x=0.6, y=0.6, w=0.4, h=0.4}, nil, nil}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Hotkey mash | |
local mash = {"cmd", "alt", "ctrl"} | |
local mash_move = {"cmd", "ctrl"} | |
local mash_app = {"shift","ctrl","alt"} | |
hs.alert("Reloaded Config") | |
-- instant window resizing | |
hs.window.animationDuration = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- watch for changes | |
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", hs.reload):start() | |
-- | |
-- start custom config | |
-- |