Skip to content

Instantly share code, notes, and snippets.

Avatar
🌹
"you're right, no human being would stack books like this"

Eric Phetteplace phette23

🌹
"you're right, no human being would stack books like this"
View GitHub Profile
@markusfisch
markusfisch / README.md
Last active Aug 9, 2021
Generate an annual commit report
View README.md

Generate an annual commit report

Prints something like this:

In 2018 you made 2488 commits in 134 projects.
The average length of a commit message was 62 characters.

Commits per weekday
    Monday     334 ******************************************
@mreidsma
mreidsma / libguides_streamline.js
Last active Feb 22, 2017
Force single linked parents to take user directly to LibGuide on home page
View libguides_streamline.js
// Make sure you are on the homepage
if($('#s-lg-index-list').length > 0) {
// Loop through all the subjects
$('#s-lg-index-cols').find('div.panel.panel-default').each(function() {
// Get the number of guides in this subject
var guides = $(this).find('.badge').text();
// console.log('Number of guides: ' + guides);
@steveklabnik
steveklabnik / wc.rs
Created Mar 23, 2015
a little wc-like in rust
View wc.rs
#![feature(collections)]
use std::io::prelude::*;
use std::fs::File;
use std::io::BufReader;
fn main() {
let args: Vec<String> = std::env::args().collect();
let filename = args[1].clone();
@othiym23
othiym23 / npm-upgrade-bleeding.sh
Created Sep 20, 2014
a safe way to upgrade all of your globally-installed npm packages
View npm-upgrade-bleeding.sh
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
View c4l-docker-outline.md
@dchud
dchud / ercamp-examples.md
Last active Dec 18, 2015
API call examples for ERcamp 2013 at GW Libraries
View ercamp-examples.md
@phette23
phette23 / fluid-width-youtube-vid.html
Last active Dec 15, 2015
Markup for making a fluid-width YouTube video embed. Better to do it in markup than use FitVids, where the markup was taken from.
View fluid-width-youtube-vid.html
<!-- just replace {{id}} with the video's ID
e.g. 9bZkp7q19f0 -->
<div style="width:100%;position:relative;padding:0;padding-top:75%">
<iframe
style="position:absolute;top:0;left:0;width:100%;height:100%;"
src="http://www.youtube-nocookie.com/embed/{{id}}?rel=0"
frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen>
</iframe>
</div>
@anarchivist
anarchivist / permissive.py
Created Nov 24, 2012
Permissive MARC Reader subclass for pymarc
View permissive.py
import pymarc
from pymarc.exceptions import RecordLengthInvalid, RecordLeaderInvalid
from pymarc.exceptions import BaseAddressInvalid, BaseAddressNotFound
from pymarc.exceptions import RecordDirectoryInvalid, NoFieldsFound
class PermissiveMARCReader(pymarc.MARCReader):
"""PermissiveMARCReader: recovers from most pymarc exceptions"""
def __init__(self, marc_target, to_unicode=False, force_utf8=False,
hide_utf8_warnings=False, utf8_handling='strict'):
super(PermissiveMARCReader,self).__init__(marc_target, to_unicode,
@jasonclark
jasonclark / cite-this-uncompressed.js
Created Oct 4, 2012
CiteThis Bookmarklet (Javascript unencoded and uncompressed)
View cite-this-uncompressed.js
javascript: (function () {
var h = document.createElement('div');
var t = document.getElementsByTagName('title')[0];
var info = '<p><strong>Title(' + t.innerHTML.length + '):</strong> ' + t.innerHTML + '</p>';
var m = document.getElementsByTagName('meta');
for (var i = 0; i < m.length; i++) {
if (null !== m[i].getAttribute('name')) {
var c = m[i].getAttribute('content');
info += '<p><strong>' + m[i].getAttribute('name') + '(' + c.length + '):</strong> ' + c + '</p>';
}