Skip to content

Instantly share code, notes, and snippets.

@barnabyalter
barnabyalter / gist:49305cfb9c05cc77e799
Created April 20, 2015 15:09
Convert images between types
sips -s format png ./*.gif --out pngs
@barnabyalter
barnabyalter / gist:a54743472777d0dd6525
Created April 20, 2015 15:17
Change the name of all files in a directory
for f in * ; do mv "$f" "PRE_$f" ; done

Magical incantations added to querystring parameters

Clear the Primo asset cache: ?&wroDevMode=true

Force a new call in Umlaut and ignor the cache: ?&umlaut.force_new_request=true

@barnabyalter
barnabyalter / gist:91329dff11dcd55f1723
Last active August 29, 2015 14:19
Configure passenger at sub-uri with a different name than sub folder
<VirtualHost *:443>
...
RewriteEngine on
DocumentRoot /apps
Alias /search /apps/findingaids
<Location /search>
PassengerBaseURI /search

Library Hours

Gives us a Grid view for a the hours for all the libraries and departments. The grid can be made for a weekly view or the monthly view. Buttons are provided to show other months or weeks. LibCal Provides us the code for these widgets. But the one thing different about these widgets is that the CSS also needs to be copied in to our site not like the other widgets by LibCal.

API Output

Option: JavaScript

Example
@barnabyalter
barnabyalter / gist:e1e9cd70a1908d39b85f
Last active September 28, 2015 20:28
Rollback schema on one branch and then proceed forward on another
~$ git checkout feature/login-integration
~$ RAILS_ENV=staging rake db:migrate VERSION=20141001211059 #Do this on the actual staging environment not your ~$ local environment
~$ git checkout development
~$ RAILS_ENV=staging rake db:migrate
@barnabyalter
barnabyalter / ssh.md
Created January 4, 2016 16:46
Connect a new computer to GitHub account

I've done this many times but every time I attempt to do it anew many months have passed and I always have to look it up again. Here is a quick reference for myself and others to do this quickly and easily.

Create SSH key

First create the ssh key on your local computer and copy to your clipboard:

~$ cd ~/.ssh && ssh-keygen
~$ cat id_rsa.pub | pbcopy
@barnabyalter
barnabyalter / phantomjs_elcapitan.md
Last active January 4, 2016 18:51
Installing phantomjs on El Capitan

PhantomJS will not install on Mac OS X El Capitan.

Trying to install the stable release will give a pleasant enough error:

~$ brew install phantomjs
phantomjs: This formula either does not compile or function as expected on OS X
versions newer than Yosemite due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
var AlephInit = {};
//window.location.replace("http://library.nyu.edu/errors/bobcatstandard-library-nyu-edu/")
var ezProxyPrefix = {"BWEB": "https://ezproxy.library.nyu.edu/login?url=", "NWEB": "https://ezproxy.library.nyu.edu/login?url=", "CU": "http://proxy.library.cooper.edu:2048/login?url=", "TWEB": "https://login.libproxy.newschool.edu/login?url=", "WEB": "", "NYSID": "http://plibrary.nysid.edu/login?url="};
var restrictedSublibraries = ["BWEB", "CU", "TWEB", "NWEB", "NYSID"];
//Initialize page after it has been loaded.
function bs_init() {
jQuery(document).ready(function() {
//Handle full page styling
bs_set_full_format();
#!/bin/bash
FAILOVER_DIRECTORY="/apps/failover_errors"
FAILOVER_REPOS="git@github.com:NYULibraries/library.nyu.edu.git"
FAILOVER_BRANCH="gh-pages"
mkdir -p $FAILOVER_DIRECTORY
if [ -d "$FAILOVER_DIRECTORY" ]; then
cd $FAILOVER_DIRECTORY
git init