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 / git-branchlog
Created February 14, 2014 14:14
Display log messages for commits in a given branch
#!/bin/sh
branchname=""
case $# in
0) branchname=$(git rev-parse --abbrev-ref HEAD) ;;
1) branchname="$1" ;;
*) branchname="$1" ;;
esac
git log $branchname --not $(git for-each-ref --format='%(refname)' refs/heads/ | grep -v "$branchname")
@jimschubert
jimschubert / README.md
Last active August 29, 2015 13:57
A simple image loader for New Tab Redirect user.

Place this file in the same directory as your image.

Place the name of your file within the quotes of the image HTML tag. For example, if your image is cats.jpg, your file would look like:

<html>
<style>
img { max-width:100%; max-height:100%; margin-left:auto; margin-right:auto; display:block;}
</style>
# Install specific version of Homebrew formula
# usage example:
# $ brew-install ssh-copy-id 6.0p1
function brew-install {
local formula version formula_hash
formula=$1
version=$2
cd `brew --prefix`
git_last_commit_id=`git rev-parse --short HEAD`
{
"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",
@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) {
@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 / 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 / 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

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 / README
Created June 26, 2011 00:30
simple fixed table header jquery plugin
Copyright (c) 2011 Jim Schubert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR