Skip to content

Instantly share code, notes, and snippets.

View iamnewton's full-sized avatar
🏠
Working from home

Newton iamnewton

🏠
Working from home
View GitHub Profile
@iamnewton
iamnewton / readFile.js
Last active December 4, 2019 22:26
Read a file line-by-line and update a line of it
const fs = require('fs');
const readline = require('readline');
const readFile = () => {
// create readline interface and output to a new file; can't figure out how to write to same file
const readInterface = readline.createInterface({
input: fs.createReadStream(findup('sonar-project.properties')),
output: fs.createWriteStream('sonar-project.properties.temp'),
console: false
});
@iamnewton
iamnewton / developer.keg
Last active November 24, 2018 21:37
A keg file for mass installation of developer-related Homebrew casks via kegger (https://github.com/chrisopedia/kegger)
brave-browser
brave-browser-beta
brave-browser-dev
chromium
chromedriver
dash
docker
dropbox
firefox
firefox-developer-edition
@iamnewton
iamnewton / personal.keg
Last active November 15, 2018 08:08
A keg file for mass installation of personal Homebrew casks via kegger (https://github.com/chrisopedia/kegger)
betterzip
qlimagesize
qlstephen
qlvideo
quicken
quicklook-csv
slack
suspicious-package
webpquicklook
@iamnewton
iamnewton / fonts.keg
Last active November 11, 2018 18:38
A keg file for mass installation of Homebrew fonts via kegger (https://github.com/chrisopedia/kegger)
font-anonymous-pro
font-arvo
font-bitter
font-input
font-inconsolata
font-league-gothic
font-orbitron
font-redacted
font-source-code-pro
font-source-sans-pro
@iamnewton
iamnewton / server.keg
Last active November 5, 2018 22:52
A keg file for mass installation of server-related Homebrew casks via kegger (https://github.com/chrisopedia/kegger)
handbrake
prismatik
screens-connect
sonos
@iamnewton
iamnewton / javascript-for-vim-refactoring.js
Created September 25, 2015 06:35 — forked from derwiki/javascript-for-vim-refactoring.js
Moving faster with Vim (5-minute lightning talk presentation). I wasn't inspired to learn effective command of Vim until I saw some people flying around faster than I thought was possible. The goal of this presentation is to call out how slow "normal" text editing is, and how many keystrokes can be reduced by using increasingly more terse Vim co…
$(function() {
// good opportunity to combine into a single statement
// qq w cw <esc> A, <esc> 0 j q
var a = 10;
var b = 20;
var c = 30;
var d = 40;
var e = 50;
// opportunity to simplify syntax
@iamnewton
iamnewton / web-notifications.js
Created March 10, 2015 20:15
Web Notifications API
if ( window.Notification && Notification.permission !== "denied" ) {
Notification.requestPermission( function( status ) { // status is "granted", if accepted by user
var n = new Notification('Title', { body: 'I am the body text!' });
});
}
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")
@iamnewton
iamnewton / README.md
Created February 11, 2015 23:53
Responsible Social Share Links

Share URLs

Here’s a collection of common social share URLs and examples of their structures along with links to documentations.

(The code has been broken up into several lines for readability—remember to remove any spaces and line breaks in the href if you copy & paste.)

Taken from Responsible Social Share Links

@iamnewton
iamnewton / stocks
Created April 24, 2015 06:41
Allows you to grab stocks from a CLI
#!/usr/bin/env bash
#
# Author:
# Newton (@chrisohpedia)
#
# Description:
# Get stock quotes
#
# Dependencies:
# None