Skip to content

Instantly share code, notes, and snippets.

Peter St.Jean pstjean

View GitHub Profile
@pstjean
pstjean / checknvm.sh
Created Jan 2, 2019
Compare current version of node to nvmrc
View checknvm.sh
git rev-parse --is-inside-work-tree > /dev/null 2>&1 && git ls-files $(git rev-parse --show-toplevel) | grep -q nvmrc
nvmrc_exist=$?
if [ $nvmrc_exist -eq 0 ]
then
node_ver=$(node --version | sed 's/^v//')
nvm_ver=$(cat $(git rev-parse --show-toplevel)/.nvmrc)
if [ $node_ver = $nvm_ver ]
then
printf "$node_ver"
exit 0
@pstjean
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
// https://www.youtube.com/watch?v=uQ1zhJHclvs
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);
outputObserver.next(y);
@pstjean
pstjean / keybase.md
Created Aug 19, 2016
Keybase Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am pstjean on github.
  • I am pstjean (https://keybase.io/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
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
pstjean / uncontrol.js
Last active Aug 29, 2015
Remove gfycat controls
View uncontrol.js
document.addEventListener('DOMContentLoaded', function(){
var gfyVid = document.getElementsByClassName('gfyVid')[0];
gfyVid.setAttribute('width','600px');
gfyVid.setAttribute('height','337px');
gfyContainer = gfyVid.parentNode;
var controls = gfyContainer.childNodes;
for(var control in controls) {
if(controls[control] instanceof HTMLElement) {
if(!controls[control].classList.contains("gfyVid")) {
gfyContainer.removeChild(controls[control]);
@pstjean
pstjean / gist:8299501
Last active Jan 2, 2016
Solarized for JSONView
View gist:8299501
/*
Solarized-ish theme for JSONView
https://github.com/gildas-lormeau/JSONView-for-Chrome
*/
body {
white-space: pre;
font-family: monospace;
background-color: #002b36;
color: #839496;
View jsonalchemy.py
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
pstjean / .gitignore_global
Created Nov 20, 2013
Global gitignore file for OS X
View .gitignore_global
# IntelliJ Files
.idea/
*.iml
*.iws
# Vim Files
*~
*.swp
*.swo
You can’t perform that action at this time.