Skip to content

Instantly share code, notes, and snippets.

View jhult's full-sized avatar

Jonathan Hult jhult

View GitHub Profile
@bryanhunter
bryanhunter / oo-banana.md
Created February 10, 2012 04:05
Joe Armstrong on reusability in software (OO-vs-functional)

I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions-- all the data comes in its input arguments and everything goes out and leaves no state behind-- it's incredibly reusable. You can just reuse it here, there, and everywhere.

-Joe Armstrong, Designer and implementer of the Erlang programming language

@fxchen
fxchen / Google Contact Phone Number Cleaner.txt
Created November 30, 2012 00:43
This Excel Formula helps format phone numbers on Google Contacts. If your gmail contacts are unorganized mess like mine used to be.
How to Clean Up Google Contact Numbers
If your Gmail contact phone numbers are unorganized, this Excel formula can help you remove format the mobile phone numbers.
Note: I added a 1 for US numbers. I like my numbers formatted this way.
1. Export the numbers you want to clean to CSV (Use Google CSV)
2. Open in Excel. The U2 column was Mobile Phone column for the file I downloaded.
3. Place this formula starting in the V2 column (this will replace the Pager column, which I did not need) and copy downwards to do the same formula replacement.
=IF((LEFT(U2,0,1)="1"),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""),CONCATENATE("1",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""))
4. Copy from V2 (downwards) and do a Paste Special starting on U2 with "Value". This will replace your previous values for mobile phone with the clean ones.
5. Save.
@l15n
l15n / Local Branches
Last active September 17, 2021 16:17 — forked from schacon/gist:942899
Delete all remote branches on your fork `mine` which have already been merged into upstream `origin/master`
$ git branch --merged master |
grep -v '*' |
grep -v master |
xargs -L1 |
xargs git branch -d
@danharper
danharper / background.js
Last active June 29, 2024 19:32
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@glnds
glnds / less-cheatsheet.md
Last active July 12, 2024 08:29
Less Cheatsheet

Less Cheatsheet

less {filename}

Navigation
SPACE forward one window
b backward one window
d forward half window
@dannysmith
dannysmith / osx_setup.sh
Last active June 24, 2024 20:35
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 4, 2024 04:16
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@stormchasing
stormchasing / Auto Check-In to Southwest Flights.user.js
Last active April 17, 2024 00:04
Auto Check-In to Southwest Flights.user.js
// ==UserScript==
// @name Auto Check-In to Southwest Flights
// @namespace http://www.ryanizzo.com/southwest-auto-check-in/
// @version 1.8
// @author Nicholas Buroojy (http://userscripts.org/users/83813)
// @contributor Ryan Izzo (http://www.ryanizzo.com)
// @contributor JR Hehnly (http://www.okstorms.com @stormchasing)
// @contributor Trevor McClellan (github.com/trevormcclellan)
// @description Automatically check in to Southwest Airline flights at the appropriate time.
// @include https://www.southwest.com/air/check-in/index.html*

Hacking the SamKnows Whitebox

The SamKnows Whitebox is a free router (TP-Link TL-WDR3600) provided by SamKnows to gather internet speed statistics. Ok that's great, but any person with a small amount of hacker's spirit will want to hack it to install some custom firmware to take advantage of the two gigantic antennas on the back, the USB ports and everything else.

Step 1 : Debug mode

Root access can be obtained via a "debug mode" on the router giving you a direct root shell via telnet, amazingly simple.

  • Disconnect the Whitebox from the internet.
  • Connect your computer directly to the Whitebox via Ethernet to one of the four ethernet ports on the Whitebox.
  • Configure your computer's IP settings to "Manual" setting the computer's IP address to 192.168.1.2, the Subnet Mask to 255.255.255.0 and the Gateway to 192.168.1.1.
  • Turn off the Whitebox.
@qvaqvaboo
qvaqvaboo / bulk_unwatch.js
Last active May 8, 2024 15:17
JIRA bulk unwatch with your browser only (JS)
// Simple JS snippet to bulk unwatch (stop watching, un-watch) issues in JIRA.
// Written and tested for JIRA 5.2, but should work for all 5+ versions.
// WHAT IT DOES:
// 1. Gets list of issues you watch using JQL search via REST API. You can modify JQL per your needs.
// 2. For each issue found, triggers REST API call to unwatch this issue for current user.
// HOWTO:
// 1. Go to JIRA in your browser, log in.
// 2. Open your browser JavaScript console.