Skip to content

Instantly share code, notes, and snippets.

Avatar
🧑‍🚀
Architecture Astronaut

Keith Cirkel keithamus

🧑‍🚀
Architecture Astronaut
View GitHub Profile
@keithamus
keithamus / guestbook.gif
Last active Sep 12, 2020
Click here to sign my guestbook!
View init.lua
hotkey.bind({"command", "option"}, 'down', function()
local resizing = hs.hotkey.modal.new()
local activeWindow = hs.window.focusedWindow()
local backdrop = hs.drawing.rectangle( hs.screen.mainScreen():frame() )
:setFillColor({ red=0, green=0, blue=0, alpha=0.2 })
local resizeIndicator = hs.drawing.rectangle({ x=0, y=0, w=0, h=0 })
:setFillColor({ red=1, green=1, blue=1, alpha=0.3 })
:setStrokeWidth(1)
:setStroke(1)
:setStrokeColor({ red=1, green=1, blue=1, alpha=0.5 })
View gist:0efae66992050d75c665
### Keybase proof
I hereby claim:
* I am keithamus on github.
* I am keithamus (https://keybase.io/keithamus) on keybase.
* I have a public key whose fingerprint is 887F 7DC5 A858 9D7D 8653 D0B7 FCCC E6EC AC15 16FC
To claim this, I am signing this object:
View 1.html
<div itemscope itemtype="http://schema.org/Thing"></div>
View collect-headers.js
var app = require('express')(),
fs = require('fs');
var headers = [];
app.get('/', function (req, res) {
headers.push(req.headers);
res.json(req.headers);
});
setInterval(function () {
fs.writeFileSync('headers.json', JSON.stringify(headers));
}, 10000);
@keithamus
keithamus / hexandrgb.js
Created Feb 20, 2013
RGB to HEX, HEX to RGB Can work with small hexes ('#000', '#f0c'), and RGB object ({r: 0, g: 0, b: 0})
View hexandrgb.js
function hex2rgb(hex) {
var int = parseInt(hex.replace(/^#/, '').replace(/^#/, '').replace(/^([\da-f])([\da-f])([\da-f])$/, '$1$1$2$2$3$3'), 16);
return {
r: (int >> 16) & 255,
g: int >> 8 & 255,
b: int & 255
};
}
@keithamus
keithamus / example_code.js
Created Nov 22, 2012
How to do Dependency Injection in RequireJS?
View example_code.js
define([], function () {
return function HypotheticalHelperMethod() {
doSomeOtherStuff();
}
});
define(["helperMethod"], function (helperMethod) {
View commit-msg
#!/bin/sh
message=`sed '/^#/,$d' $1`
firstLine=`echo "$message" | awk 'NR>1{exit};1'`
exitCode=0
txtred=$(tput setaf 1) # Red
txtrst=$(tput sgr0) # Text reset
if [[ "`echo "$firstLine" | awk '{print length()}'`" -gt 49 ]]; then
echo "${txtred}[POLICY] Ensure first line in your commit message is no longer than 50 characters${txtrst}"
@keithamus
keithamus / Nano Git Commit Syntax highlighting
Created Dec 10, 2010
Add this to your ~/.nanorc and when running "git commit" (if your editor is nano) you'll have syntax highlighting in your commit message. Includes support for "git commit -v" too!
View Nano Git Commit Syntax highlighting
syntax "gitcommit" "COMMIT_EDITMSG$"
color white "#.*"
color green "#.(modified|deleted).*"
color yellow start="# Changes.*" end="# Changed.*"
color cyan start="# Untracked.*" end="diff"
color cyan start="# Untracked.*" end="$$"
color brightred "^deleted file mode .*"
color brightgreen "^\+.*"
color brightred "^-.*"
color brightyellow "^(diff|index|---|\+\+\+).*"
You can’t perform that action at this time.