This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PollStation | |
start: => @runner = setInterval @oneSecond, 50 | |
stop: => clearInterval(@runner) | |
runner: undefined | |
doOn: (num, func, args) => | |
$(document).on 'poll:oneSecond', (e, second, epochSecond) -> | |
if (epochSecond % num) == 0 | |
$(document.body).trigger("poll:#{num}Second") | |
func() | |
oneSecond: => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Artist | |
include Mongoid::Document | |
has_many :history_events, autosave: true, validate: true | |
end | |
class HistoryEvent | |
include Mongoid::Document | |
belongs_to :artist | |
validates_presence_of :headline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TileProcessor | |
def tile temp_object,tile_size=256 | |
geom = "#{tile_size}x#{tile_size}" | |
temf = Tempfile.open('o.ptif') | |
`convert #{temp_object.path} -define tiff:tile-geometry=#{geom} -compress jpeg 'ptif:#{temf.path}'` | |
temf | |
end | |
end | |
tiled_images.processor.register(TileProcessor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# store the job before it has a chance to be served by dragonfly | |
images.configure do |c| | |
c.define_url do |app, job, opts| | |
thumb = ThumbTracker.where(job: job.serialize).first | |
unless thumb | |
uid = job.store | |
thumb = ThumbTracker.create!( | |
:uid => uid, | |
:job => job.serialize | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# renders markdown with footnotes matching Pandoc's syntax, | |
# but renders html with custom formatting in the class methods link_to_text_replace, link_to_fn_replace | |
class CatalogEntry | |
LINK_TO_FN = "[^%d] " | |
LINK_TO_TEXT = "[^%d]: %s" | |
CITATION = "%{last}, %{first}%{other}. \"%{title}.\" In _Bits & Pieces Put Together to Present a Semblance of a Whole: Walker Art Center Collections_, edited by Joan Rothfuss and Elizabeth Carpenter. Minneapolis, MN: Walker Art Center, 2005." | |
FILE_TEMPLATE = "B&Pcat-%{last},%{first}_2005" | |
FILE_NAME_REGEX = /B&Pcat-(.+),(.+)_2005.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wraps third..+ paragraphs in div.more_content | |
# first two paragraphs are left in tack | |
def read_more_content html | |
first, second, *rest = Nokogiri::HTML::fragment(html).children | |
out = first.to_s + second.to_s | |
if rest.present? | |
out << "\n\n<div class=\"more_content\">" | |
out << rest.map(&:to_s).reduce(:+) | |
out << "</div>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%li.reference_group | |
.container-fluid | |
.row-fluid | |
.span1.move | |
%i.icon-move | |
.span4 | |
= f.input_field :label_markdown, placeholder: '<markdown enabled>' | |
= f.input :order, as: :hidden | |
.span7 | |
= f.link_to_remove class: 'btn btn-danger' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq ruby-deep-indent-paren nil) | |
(defadvice ruby-indent-line (after unindent-closing-paren activate) | |
(let ((column (current-column)) | |
indent offset) | |
(save-excursion | |
(back-to-indentation) | |
(let ((state (syntax-ppss))) | |
(setq offset (- column (current-column))) | |
(when (and (eq (char-after) ?\)) | |
(not (zerop (car state)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nfs_volumes: | |
home: "%{gdnet_env}-netapp1:/vol/home/qtree0" | |
yum_cache: "%{gdnet_env}-netapp1:/vol/yum_cache/qtree0" | |
techops: "%{gdnet_env}-netapp1:/vol/techops/qtree0" | |
websites: "%{gdnet_env}-netapp1:/vol/websites_%{gdnet_env}/qtree0" | |
apache_logs: "%{gdnet_env}-netapp1:/vol/apache_logs_%{gdnet_env}/qtree0" | |
evolution_logs: "%{gdnet_env}-netapp1:/vol/evolution_logs_%{gdnet_env}/qtree0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject intrepid-life-coffee "0.1.0-SNAPSHOT" | |
:description "website to advertise the coffee shop" | |
:url "www.intrepidlifecoffee.com" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[compojure "1.1.6"] | |
[ring "1.2.1"] | |
[hiccup "1.0.5"] | |
;; [org.slf4j/log4j-over-slf4j "1.6.6"] ;;avoids dep loop |