Skip to content

Instantly share code, notes, and snippets.

Peter St.Jean pstjean

View GitHub Profile
pstjean /
Created Jan 2, 2019
Compare current version of node to nvmrc
git rev-parse --is-inside-work-tree > /dev/null 2>&1 && git ls-files $(git rev-parse --show-toplevel) | grep -q nvmrc
if [ $nvmrc_exist -eq 0 ]
node_ver=$(node --version | sed 's/^v//')
nvm_ver=$(cat $(git rev-parse --show-toplevel)/.nvmrc)
if [ $node_ver = $nvm_ver ]
printf "$node_ver"
exit 0
pstjean / rxjs-from-scratch.js
Last active Dec 19, 2018
RxJS from scratch
View rxjs-from-scratch.js
// From André Staltz's talk at ng-europe 2016
function map(transformFn) {
const inputObservable = this; // Object created by createObservable
const outputObservable = createObservable(function subscribe(outputObserver) {
inputObservable.subscribe({ // Give me data from the inputObservable
next: function (x) {
const y = transformFn(x);;
pstjean /
Created Aug 19, 2016
Keybase Verification

Keybase proof

I hereby claim:

  • I am pstjean on github.
  • I am pstjean ( on keybase.
  • I have a public key whose fingerprint is 0D53 110C 83D2 C131 3226 1494 7979 B907 A88B 863E

To claim this, I am signing this object:

pstjean / .songfmtrc
Last active Feb 28, 2016
Format song lyrics with Vim
View .songfmtrc
# Trim punctuation and whitespace from EOL
let @a='%s/[.|,|;|:][ \t]*$//g'
# Uppercase first letter of each line
let @b='%s/^\([a-z]\)/\U\1/g'
pstjean / uncontrol.js
Last active Aug 29, 2015
Remove gfycat controls
View uncontrol.js
document.addEventListener('DOMContentLoaded', function(){
var gfyVid = document.getElementsByClassName('gfyVid')[0];
gfyContainer = gfyVid.parentNode;
var controls = gfyContainer.childNodes;
for(var control in controls) {
if(controls[control] instanceof HTMLElement) {
if(!controls[control].classList.contains("gfyVid")) {
pstjean / gist:8299501
Last active Jan 2, 2016
Solarized for JSONView
View gist:8299501
Solarized-ish theme for JSONView
body {
white-space: pre;
font-family: monospace;
background-color: #002b36;
color: #839496;
import simplejson
import sqlalchemy
from sqlalchemy import String
from sqlalchemy.ext.mutable import Mutable
class JSONEncodedObj(sqlalchemy.types.TypeDecorator):
"""Represents an immutable structure as a json-encoded string."""
impl = String
pstjean / .gitignore_global
Created Nov 20, 2013
Global gitignore file for OS X
View .gitignore_global
# IntelliJ Files
# Vim Files
You can’t perform that action at this time.