Skip to content

Instantly share code, notes, and snippets.

View afaur's full-sized avatar

Adam Faur afaur

View GitHub Profile

Keybase proof

I hereby claim:

  • I am afaur on github.
  • I am afaur (https://keybase.io/afaur) on keybase.
  • I have a public key ASAAVllue4XWA1NQvnqNVV5Ex5_X6vBqWTHsUGHl-Y6_Ogo

To claim this, I am signing this object:

@afaur
afaur / resize_terminal_with_command.sh
Created May 23, 2016 13:59
Resize a terminal window using a command. Helpful when you like to keep fullscreen terminal after adding a new tab or adjusting font size (cmd -/+).
// Make sure top left corner is positioned before running
// What the command means:
// `\e[8; Height;Width t`
printf '\e[8;55;213t'
@afaur
afaur / apple_2_keyboard_maps.txt
Created May 24, 2016 15:23
Apple Keyboard 2 Key Maps
For smaller form factor keyboard.
To retain the forward delete (117)
I map my right hand side alt/opt key to be forward delete.
To have more convient control key access I swap caps with control.
<!DOCTYPE HTML>
<html>
<head>
<title>CSS SPA</title>
<style>
#content > #blog:not(:target) + #contact:not(:target) + #home,
#content > div:target {
display: block;
}
#content div:not(:target) {
@afaur
afaur / private.xml
Last active August 23, 2016 13:59
Karabiner Settings for Mac OSX ctrl + hjkl enabled movement.
<?xml version="1.0"?>
<root>
<appdef>
<appname>FINDER_OR_SYSPREF</appname>
<equal>com.apple.finder</equal>
<equal>com.apple.systempreferences</equal>
<equal>com.apple.Preview</equal>
</appdef>
<item>
<name>HJKL Mode</name>
@afaur
afaur / PHP_Form_Field_Mapping_Replacement.php
Created November 21, 2016 20:08
PHP Form Field Mapping Replacement
<?php
$search_by_keys = array(
'foo',
'bar',
'baz'
);
$replace_with_keys = array(
'meow',
@afaur
afaur / filter_vim.js
Created December 1, 2016 08:30
Filter vim using `!` for example `!!node filter_vim.js` will remove the vowels of the current line.
process.stdin.setEncoding('utf8')
var chunks = []
process.stdin.on('readable', function () {
var chunk = process.stdin.read()
chunks.push(chunk)
})
process.stdin.on('end', function () {
var input = chunks.join('')
marketing:
submit to electron
hacker news
reddit
electron weekly
javascript weekly
react weekly
product hunt
alternative to
// site: http://www.beaufortonline.com/building-and-construction-terms-dictionary/
// Get element with class '.nine'
var items = document.querySelector('.nine').getElementsByTagName('p');
// Find total amount of 'p' elements inside of tag with class '.nine'
var total = items.length;
// Collect terms and definitions
var terms = {}
@afaur
afaur / Mac OSX Sierra 10.12.1 Instructions.sh
Created January 13, 2017 00:27
Installing older .h files that are no longer in the latest Mac OSX SDK
# Go the temp directory on your machine
cd /tmp
# Download the 10.11 sdk from apple
wget http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_macOS_10.11_for_Xcode_8.2/Command_Line_Tools_macOS_10.11_for_Xcode_8.2.dmg
# (If you don't have wget copy the dmg to the `/tmp` folder)
# Mount the dmg
hdiutil attach Command_Line_Tools_macOS_10.11_for_Xcode_8.2.dmg