Skip to content

Instantly share code, notes, and snippets.

View KevinTCoughlin's full-sized avatar

Kevin Coughlin KevinTCoughlin

View GitHub Profile
@KevinTCoughlin
KevinTCoughlin / proxy-switch.sh
Last active January 26, 2019 13:25
Simple bash script to set/unset my common proxy settings.
#!/bin/bash
set -o nounset
set -o errexit
HOST="example.com"
PORT=8080
if [ $1 == "on" ]; then
eval `export http_proxy=http://$HOST:$PORT`
eval `npm config set proxy http://$HOST:$PORT`
eval `git config --global http.proxy http://$HOST:$PORT`
echo Proxy Set
@KevinTCoughlin
KevinTCoughlin / winjs-converter.js
Created April 16, 2014 11:07
Smodr - winjs-converter
/**
* Kevin Coughlin <kevintcoughlin@gmail.com>
*/
(function () {
'use strict';
WinJS.Namespace.define("Converters", {
/**
* Convert current time and duration to human
* readable string.
@KevinTCoughlin
KevinTCoughlin / programming_to_read
Created April 24, 2014 14:40
Programming Reading Resources
Programming basics:
- How to Think Like A Computer Scientist - http://www.greenteapress.com/thinkpython/thinkpython.html
- Think Complexity - http://greenteapress.com/complexity/thinkcomplexity.pdf
- SICP - http://mitpress.mit.edu/sicp/
---
Web/Development basics:
- Team Treehouse modules on git, shell commands, DNS, etc -http://teamtreehouse.com
- How Does The Internet Work? - http://www.stanford.edu/class/msande91si/www-spr04/readings/...
- Udacity Web Dev course - https://www.udacity.com/course/cs253
---
@KevinTCoughlin
KevinTCoughlin / podr-parser.js
Last active February 19, 2019 02:35
Podcast RSS feed parser example in node.js
/* jslint node: true */
'use strict';
var FeedParser = require('feedparser');
var request = require('request');
var url = 'http://smodcast.com/channels/smodcast/feed';
var options = {};
var req = request(url);
var feedparser = new FeedParser(options);
@KevinTCoughlin
KevinTCoughlin / tumblr-oauth-client.js
Last active August 29, 2015 14:06
Tumblr OAuth Client for Windows 8/8.1
(function () {
"use strict";
/**
* Tumblr OAuth Client
*/
WinJS.Namespace.define('TumblrOAuth', {
client: WinJS.Class.define(function (consumerKey, consumerSecret) {
this._consumerKey = consumerKey;
this._consumerSecret = consumerSecret;
@KevinTCoughlin
KevinTCoughlin / st3
Created March 24, 2015 13:15
ST3 Changelog
Build 3080
Release Date: 24 March 2015
See also the Blog Post
Fixed Redo sometimes restoring the selection to the incorrect location
Reworked how Build Systems are selected (More Information)
Build Systems may now declare "keyfiles" (e.g., 'Makefile' for the Make build system) to better auto detect which build system to use
Improved handling of build systems that generate lots of output
New windows always use the automatic build system, rather than the build system of the last used window
Command Palette now remembers the last entered string
Improved change detection for files that disappear and reappear, as happens with disconnected network drives
@KevinTCoughlin
KevinTCoughlin / chromecast-audio-example.js
Created April 20, 2015 02:55
ChromeCast audio example
(function() {
'use strict';
var session = null;
var episodeUrl = 'http://ec.libsyn.com/p/9/2/2/92263366ea06064d/p635.mp3?d13a76d516d9dec20c3d276ce028ed5089ab1ce3dae902ea1d06ca8e32d1cd58c77c&c_id=8791174';
var currentMedia = null;
window['__onGCastApiAvailable'] = function(loaded, errorInfo) {
if (loaded) {
initializeCastApi();
@KevinTCoughlin
KevinTCoughlin / InfiniteRecyclerOnScrollListener.java
Created April 29, 2015 01:46
Scroll listener for RecyclerView to infinitely paginate
public abstract class InfiniteRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public final static String TAG = InfiniteRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0;
private boolean loading = true;
private int current_page = 0;
private final LinearLayoutManager mLinearLayoutManager;
public InfiniteRecyclerOnScrollListener(LinearLayoutManager linearLayoutManager) {
this.mLinearLayoutManager = linearLayoutManager;
@KevinTCoughlin
KevinTCoughlin / tumblr_post_by_blog.js
Last active August 29, 2015 14:22
Example tumblr.js get post by blog name and id
var tumblr = require('tumblr.js');
var client = tumblr.createClient({ consumer_key: /* your consumer key */ });
client.posts('annetje-stichting', { id: 119348740950 }, function (err, data) {
console.log(data);
/**
* Example output:
* ...
* note_count: 0,
* caption: '<h2>helping kids in tough times</h2><p>lorem ipsumlorem ipsumlorem ips
@KevinTCoughlin
KevinTCoughlin / 4-27-15-challenge-212.js
Created June 15, 2015 03:22
Solution for /r/dailyprogrammer's [2015-04-27] Challenge #212 [Easy] Rövarspråket
var input = ['Jag talar Rövarspråket!', 'I\'m speaking Robber\'s language!'];
function rovarsprakify(str) {
var result = [];
for (var c of str) {
var newChar = (isVowel(c) || !isAlpha(c)) ? c : c + 'o' + c.toLowerCase();
result.push(newChar);
}
return result.join('');
}