Skip to content

Instantly share code, notes, and snippets.

View jimschubert's full-sized avatar
🎯
Always here to help.

Jim Schubert jimschubert

🎯
Always here to help.
  • Richmond, VA
View GitHub Profile
@jimschubert
jimschubert / functions
Last active May 8, 2016 14:55
A bash function to display recently changed files recursively below the current directory
#!/bin/env bash
# Display recently changed files recursively below the current directory
# recent [minutes]
# minutes: The number of minutes to display. Default 5.
#
# Credit to find usage goes to
# F. Hauri (http://superuser.com/users/178656/f-hauri)
# see: http://superuser.com/a/621727/60571
function recent {
@jimschubert
jimschubert / terminal
Created April 6, 2016 13:12
/Applications/Docker/Kitematic (Beta).app/Contents/Resources/resources/terminal for iTerm2 3.0 beta
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CMD="clear && $*"
ITERM_EXISTS=`osascript <<EOF
set doesExist to false
try
do shell script "osascript -e 'exists application \"iTerm2\"'"
set doesExist to true
@jimschubert
jimschubert / stripMargin.js
Created December 15, 2015 12:23
ES6/ES2015 tag function to support "indented" strings like Scala's stripMargin function.
/**
* Allows Scala-like stripMargin
*
* Parameters are applied implicitly via ES2015.
*
* @example
* // returns "The Number is:\n 100\nThanks for playing!"
* let num = 100
* let result = stripMargin`The Number is:
* | ${num}
@jimschubert
jimschubert / dotnet.js
Created November 23, 2015 18:53
Gulp build for dotnet tasks
'use strict';
import gulp from 'gulp';
import gutil from 'gulp-util';
import { spawn } from 'child_process';
function runner(cmd, args){
return function(callback) {
let command = spawn(cmd, args);
command.stdout.pipe(process.stdout);
javascript: var search = ((document.getElementsByName('ASIN')[0]||document.getElementsByName('ASIN.0')[0]||{}).value || ((document.querySelectorAll('[rel="dc:identifier"],[itemprop="isbn"]')[0]||{}).innerText||''.replace(/-/,''))); if(!search) { alert("Amazon, Packt, or O'Reilly product not found.")} else { var x = window.open('http://www.goodreads.com/review/isbn/'+ search, 'add_review'); x.focus(); }
@jimschubert
jimschubert / AA.md
Last active August 29, 2015 14:12
System76 Pangolin Performance - $500

For Sale: $500

I'm selling my System76 Pangolin Performance notebook computer. System76 is a company that custom builds machines that come pre-loaded with Ubuntu Linux. This machine is a beast and I've loved it. I'm selling it for two reasons:

  • It's a little heavy
  • I wanted to switch to Mac

I've used Linux since about 1997. I've been through distro kicks of Redhat, SuSE, Mandrake, Slackware with brief diversions to FreeBSD and OpenBSD. Linux and Unix have been my main operating system choices for a long time. I had avoided Mac because I was under the assumption that it wasn't a true Unix variant. It's actually registered with the Single UNIX Specification version 3 since 2007. I gave it a few years before trying it (despite my false understanding of its Unix-y-ness), then got hooked on OS X while working at Expedia. Since leaving Expedia, I've wanted to delve into OS X development using Swift… and that's a little difficult to do on Linux. Best B

@jimschubert
jimschubert / count.js
Created November 6, 2014 17:44
Count stylesheet rules. From EpokK at http://stackoverflow.com/a/20496041/151445
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@jimschubert
jimschubert / sample.sh
Created November 3, 2014 01:25
Why use ES6 Map?
$ node --harmony
> var person = { name: "Jim", age: 34 };
undefined
> var map = new Map()
undefined
> map.set(person, 'JavaScript');
undefined
> person.name = "James";
'James'
> map.get(person)
@jimschubert
jimschubert / sample.js
Created October 29, 2014 15:57
Tweaking $http response without a response interceptor (AngularJS)
function makeRequest(){
// var config = {...}
var query = $http(config);
query.then(function onSuccessIntermediate(response) {
// When this HTTP response comes back, we will use this function to tweak any data
var deferred = $q.defer();
var promise = deferred.promise;
// $http has a success and error helper function, so we need to make this promise look the same.
promise.success = function(fn) {
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",