Skip to content

Instantly share code, notes, and snippets.

View jamesmacfie's full-sized avatar

James Macfie jamesmacfie

  • Featherston, New Zealand
View GitHub Profile
@jamesmacfie
jamesmacfie / .editorconfig
Created June 7, 2014 02:34
The .editorconfig I use with my projects
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true
@jamesmacfie
jamesmacfie / init.coffee
Created August 21, 2014 23:28
A small bit of code that adds the ability to close all open tabs in your Atom editor. Put this in your init.coffee file (then reload Atom) and then 'Close All Tabs' will be an available option in the Command Palette
atom.workspaceView.command 'pane:close-all-tabs', ->
panes = atom.workspace.getPanes()
for pane in panes
pane.destroy()
@jamesmacfie
jamesmacfie / decision.coffee
Created September 26, 2014 02:17
Simple hubot decision maker
# Description:
# Decides between two given options
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@jamesmacfie
jamesmacfie / waltquote
Created October 7, 2014 02:52
Inappropriate quotes and stuff
# Description:
# Spits out quotes
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@jamesmacfie
jamesmacfie / demo.ino
Last active August 29, 2015 14:09
A small snippet of code that turns on and off three solenoid valves via an Arduino. The test code turns on three valves for two seconds each.
/*
* Test app that turns three solenoid valves on at set intervals and duration over a
* set time period
*/
// The time to test the current time against
long startTime = 0;
// Poorly named variable - the time before the timer resets itself back to '0'
long dayLength = 6000;
@jamesmacfie
jamesmacfie / regex.js
Created December 21, 2014 18:54
A small .js regex to get a string between two characterse
// Example usage
"This is my {string}".match(/{(.*)}/).pop(); // string
// Example function
function extractString(string, startChar, endChar) {
var re = new RegExp([startChar, '(.*)', endChar].join(''));
return string.match(re);
}

Keybase proof

I hereby claim:

  • I am jamesmacfie on github.
  • I am jamesmacfie (https://keybase.io/jamesmacfie) on keybase.
  • I have a public key whose fingerprint is 3DBC CE0A 6225 4904 FD17 7148 57BF 3CF5 BE37 BAA6

To claim this, I am signing this object:

@jamesmacfie
jamesmacfie / howto.md
Last active March 2, 2017 01:13
How to publish a new version of the recorder

How to publish a new version of the recorder

Open the PointGrayRecorder solution in Chimera

It lives at https://github.com/8i/Chimera/blob/master/Recorder/V1/PointGrayRecorder/PointGrayRecorder.sln. Lol.

Alter the server app post build step

I've never got the post build steps to run. When I first got the recorder setup on my machine with Bob's help we simply deleted the code in here as it wasn't needed for the ServerApp project. So you should just do this too. Only thing to remember here is to not commit this change.

@jamesmacfie
jamesmacfie / urghStuff.js
Created June 15, 2018 00:09
Find the most negative comment on Stuff.co.nz articles
const findTheMostNegativeComment = () => {
const voteVals = [];
const votes = document.querySelectorAll('.gig-comment-vote-total');
[].forEach.call(votes, (v) => {
const val = v.innerHTML;
if (val.charAt(0) === '-') {
voteVals.push({
text: val,
total: parseInt(val.slice(1)),
el: v
@jamesmacfie
jamesmacfie / script.applescript
Created June 21, 2018 00:51
Use iTerm as terminal in Alfred
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \":Applications:iTerm.app\"
activate
try
select first window
set onlywindow to true
on error