Skip to content

Instantly share code, notes, and snippets.

View ocr-shot.sh
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@azaroth42
azaroth42 / info.json
Last active Oct 15, 2016
Ultra simple AV info.json
View info.json
{
"@context": "http://iiif.io/api/av/0/context.json",
"id": "https://iiif-staging02.lib.ncsu.edu/iiifv/pets",
"profile": "http://iiif.io/api/av/0/level1.json",
"attribution": "Provided by NCSU",
"logo": "http://ncsu.edu/logo.png",
"rights": "http://creativecommons.org/4.0/cc-by/",
"sizes": [
@benjie
benjie / README.md
Last active Nov 27, 2018
Long Live CoffeeScript and Long Live ES6
View README.md

Long Live CoffeeScript and Long Live ES6

Clearly ES6 is a huge improvement over ES5, and tools like [6to5][] allow us to use these cool features now. I was reading [Replace CoffeeScript with ES6][replace coffeescript] by [Blake Williams][] and thought it was a great summary of how ES6 solves many of the same problems that CoffeeScript solves; however I'd like to comment on a few of Blake's points and talk about why I'll be sticking with CoffeeScript.

Classes

Classes in ES6 (like many of the syntax changes in ES6) are very similar to the CoffeeScript equivalent. To support browsers that are not fully ES5 compliant (e.g. IE8-), however, we still can't really use getters/setters, so ignoring these the comparison is:

@hasan-ally
hasan-ally / net_ldap_overrides.rb
Created Apr 2, 2014
Verify the certificate of secure LDAP server using net-ldap ruby gem
View net_ldap_overrides.rb
class Net::LDAP
def initialize(args = {})
@host = args[:host] || DefaultHost
@port = args[:port] || DefaultPort
@verbose = false # Make this configurable with a switch on the class.
@auth = args[:auth] || DefaultAuth
@base = args[:base] || DefaultTreebase
encryption args[:encryption] # may be nil
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created Jan 29, 2013
This bookmarklet gives you a code editor in your browser with a single click.
View Ruby Notepad Bookmarklet
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
View rdfa_prototypes.html
<!DOCTYPE html>
<html>
<head>
<base href="http://d.lib.ncsu.edu/collections/catalog/mc00096-001-ff0155-000-001_0001" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
@pristinenoise
pristinenoise / blacklight_google_analytics.rb
Created Apr 9, 2012
changing to environment friendly
View blacklight_google_analytics.rb
# Change to your Google Web id
BlacklightGoogleAnalytics.web_property_id = case Rails.env.to_s
when 'development'
'UA-3-1'
when 'test'
nil
else
'UA-2-1'
end
View actionpack.lib.action_controller.status_codes.rb
Status Code Status Message Symbol
1xx Informational
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing
2xx Success
200 OK :ok
201 Created :created
202 Accepted :accepted
@simi
simi / Gemfile
Created Feb 7, 2012
Refinery + Twitter Bootstrap WIP
View Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@cjweeg
cjweeg / "BagIt" error finder
Created Dec 20, 2011
Looks through a "BagIt" Missing-Files-manifest and locates lines where the string "._" does not occur
View "BagIt" error finder
#!/usr/bin/env ruby
# ARGV[0] should point to the directory where the "BagIt" text file is stored
if !ARGV[0]
puts "You must specify the directory \"BagIt\" text file is stored. Try again!"
exit
end
# first we find the full path of the argument in case we're only given