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
# 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`
@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>
@jimschubert
jimschubert / README.md
Last active October 30, 2023 01:33
prepare-commit-msg which adds branch name and description to the end of a commit message (git hook)

Installation

To install globally, copy prepare-commit-msg to /usr/local/share/git-core/templates/hooks and execute:

chmod +x /usr/local/share/git-core/templates/hooks/prepare-commit-msg

To install per-repository, copy prepare-commit-msg to /path/to/repo/.git/hooks/prepare-commit-msg and mark it as executable.

@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 / MyActivity.scala
Created November 2, 2013 03:15
An example of drawing a triangle in Android using Scala. Converted from an example in Pro Android 3 http://www.apress.com/9781430232223
package com.example.AndroidPlaytime
import javax.microedition.khronos.opengles.GL10
import javax.microedition.khronos.egl.EGLConfig
import android.opengl.{GLSurfaceView, GLU}
import android.content.Context
import java.nio.{ByteOrder, ByteBuffer}
import android.app.Activity
import android.os.Bundle
import android.view.Window
@jimschubert
jimschubert / GzipFilter.scala
Last active December 21, 2015 16:09
A take a gzip compression for JavaScript and CSS in Finatra
package com.ipreferjim.resume
import com.twitter.finagle.{Service, SimpleFilter}
import com.twitter.finagle.http.{Method, Response, Request}
import com.twitter.util.Future
import com.twitter.finagle.http.MediaType
import java.util.zip.GZIPOutputStream
import org.jboss.netty.buffer.ChannelBuffers
import org.jboss.netty.handler.codec.http.HttpHeaders
import org.apache.commons.io.output.ByteArrayOutputStream
#Create a new file in your home directory called .gtkrc-eclipse
# call eclipse with this command:
# env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/USER/.gtkrc-eclipse '/path_to_eclipse/eclipse'
# In your Eclipse directory find the file 'plugins/org.eclipse.platform_4.2.*/css/e4_default_gtk.css'
# (there's an * in there, because I guess that the version may change in the future or may be different already).
# In this file there's a CSS class:
#.MPartStack {
@jimschubert
jimschubert / webstorm.desktop
Created June 25, 2013 02:15
Webstorm.desktop definition: `~/.local/share/applications/webstorm.desktop`
[Desktop Entry]
Version=1.0
Type=Application
Name=WebStorm
Icon=/home/jim/bin/WebStorm-127.68/bin/webide.png
Exec="/home/jim/bin/WebStorm-127.68/bin/webstorm.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupNotify=true
@jimschubert
jimschubert / README.md
Created November 2, 2012 13:56
on{x} script: Between 11:00 PM and 7:00 AM, 50% ringer for known contacts and 5% other audio

on{x} script: Between 11:00 PM and 7:00 AM, 50% ringer for known contacts and 5% other audio

on{x} is an application developed by Microsoft for Android phones. It exposes a pretty large amount of the Android API to be scripted using JavaScript. This allows you to script actions like "Disable the wringer when I flip the phone over" or "Display a weather notification at 7:50am" or any number of other things.

This script automates something I think should be a part of Android: disabling/lowering ringer and notification sounds during bedtime while allowing calls from your contacts to be heard. I'd previously used an application called 'Bedside' or something, but I had to remember to enable it at night and disable it in the morning. Other applications either don't provide a whitelist of allowed contact phone numbers.

TODO

When I'm able to query contact groups, I'd like to apply a filter to the contacts loop to allow only calls from my 'Favorites' to be heard.

@jimschubert
jimschubert / cdata.snippet
Created September 25, 2012 19:47
Visual Studio snippet to surround xml select with CDATA tags
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>
<!-- _locID_text="title" _locComment="" -->cdata</Title>
<Author>Jim Schubert</Author>
<Description>
<!-- _locID_text="description" _locComment="" -->XML snippet for surrounding select with CDATA tags</Description>
<SnippetTypes>
<SnippetType>SurroundsWith</SnippetType>