Skip to content

Instantly share code, notes, and snippets.

View jhenry's full-sized avatar

Justin Henry jhenry

View GitHub Profile
@jhenry
jhenry / rails-template-draft
Created September 16, 2009 03:01
rails template with testing harnesses, jquery, etc
# Clear out stuff we won't use
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
run "rm -rf test/"
# Create the readme file
run "echo TODO: Explain yourself! > README.markdown"
#!/usr/bin/env ruby -wKU
text_source = ARGV[0] || 'ipsum'
filename = File.join(File.dirname(__FILE__), text_source + '.txt')
copy_to_use = File.read(filename)
if text_source == 'ipsum'
chopped_copy = copy_to_use.scan(/.*?[.!?](?:\s|$)/)
@jhenry
jhenry / tmux_textaurant.sh
Created January 11, 2011 02:50 — forked from dpickett/tmux_textaurant.sh
./tmux_starter_pistol.sh projectname
export PROJECT_NAME=$1
export WORKING_DIR=~/working/active/$PROJECT_NAME
cd $WORKING_DIR;
tmux start-server
tmux new-session -d -s $PROJECT_NAME -n work
tmux new-window -t$PROJECT_NAME:1 -n server
tmux new-window -t$PROJECT_NAME:2 -n test
class ArticleIndexTest < ActiveSupport::TestCase
def setup
# create a parent page, which will display our index list
page_index = Cms::Page.new(
:slug => "top_page",
:label => "Page Top")
page_index.save!
# create Children, so we have something to list
(3.times).each { |i|
module CmsHelper
def embed_calendar_widget(area_slug)
calendar = Cms::Page.find_by_slug("#{area_slug}_calendar")
is_enabled = get_page_block(calendar.blocks, "is_enabled")
widget_body = get_page_block(calendar.blocks, "widget_body")
if is_enabled == 'true'
content_tag(:div, widget_body, :id => "calendar_widget")
@jhenry
jhenry / batch_file_generator.rb
Created January 23, 2013 23:25
Quick and dirty Bb batch file creator is quick and dirty.
#!/usr/bin/env ruby
id_prefix = "ETS_HELPLINE"
user_list = "jhenry,bbaggin,fbaggin".split(',')
course_title_suffix = "001: ETS Helpline Sandbox Space"
t = Time.now()
datestamp = t.strftime("%Y%m%d")
users = Hash.new

Keybase proof

I hereby claim:

  • I am jhenry on github.
  • I am jhenry (https://keybase.io/jhenry) on keybase.
  • I have a public key ASBjQ3ZNbPgHr4FZDndcNAxGZPEp8kYSLIuyDW8oU9bfzgo

To claim this, I am signing this object:

@jhenry
jhenry / bbid.js
Created July 31, 2020 17:09
Bb Id - Bookmarklet to show Blackboard Ids
javascript:(function()%7Bif('jQuery'%20in%20window)%7Blet%20showUids%3D(jq)%3D%3E%7Bjq('tbody%23listContainer_databody%20%3E%20tr').each((i%2Ctr)%3D%3E%7B%20var%20val%20%3D%20jq('input%5Btype%3Dcheckbox%5D'%2C%20tr).prop('value')%3B%20jq('th'%2C%20tr).append('%3Cdiv%3E%3Ci%3E'%2Bval%2B'%3C%2Fi%3E%3C%2Fdiv%3E')%3B%20%7D)%7D%3Blet%20ws%3D%5B%5D%3Bws.push(window)%3Blet%20ifr%3DjQuery('iframe').prop('contentWindow')%3Bif(ifr)%7Bws.push(ifr)%3B%7Dws.forEach((w)%3D%3E%7BshowUids(w.jQuery)%3B%7D)%3B%7D%7D)()
@jhenry
jhenry / jwplayer-theater-mode.js
Created December 12, 2020 23:49
jwplayer theater mode button
/* Your theater-mode.svg file for the icon might look something like:
345,93 Bot
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">
<rect x="5" y="20" width="70" height="35" fill-opacity="0.01" stroke-width="8" stroke="lightgrey" shape-rendering="crispEdges" />
</svg>
*/
const buttonId = 'theater-mode-button';
const iconPath = '/theater-mode.svg';
const tooltipText = 'Theater Mode';
@jhenry
jhenry / add-new-item-sync.scpt
Created March 6, 2021 18:05
Folder Action Handler to upload an added file and copy URL
(*
droplet - upload and copy url
This Folder Action handler is triggered whenever items are added to the attached folder.
The script uploads the file to the specified destination, and puts the URL in the clipboard.
Adapted from Ken Mickels' gist:
https://gist.github.com/kenmickles/bf8ffbf7117f4b394ff01c8edac11ebd