This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
; Extends Nodelist in order for us to just map through nodelists (array like js objects) | |
(extend-type js/NodeList | |
ISeqable | |
(-seq [array] (array-seq array 0))) | |
(defn download-csv [csv filename] | |
(let [csv-file (js/Blob. (clj->js [csv]) {:type "text/csv"}) | |
download-link (.createElement js/document "a")] | |
(aset download-link "download" filename) | |
(aset download-link "href" (.createObjectURL (aget js/window "URL") csv-file)) |
<div class="container"> | |
<button class="stick-to-bottom-button"></button> | |
</div> | |
<style> | |
.container { | |
position: relative; | |
} | |
.stick-to-bottom-button { |
ack-grep --print0 -irl 'Online' | xargs -0 -L1 sed -i 's/Online/Healthy/g' |
# Remove trailing spaces from files | |
sed -i 's/[ \t]*$//g' app/**/*.rb | |
# Convert tabs to spaces | |
sed -i 's/[ ]/ /g' app/**/*.rb |
# Can't remember where I found this, backing it up here. | |
# Use bottom script like so | |
# on.condition(:restart_file_touched) do |c| | |
# c.interval = 5.seconds | |
# c.restart_file = File.join(rails_root, 'tmp', 'restart.txt') | |
# end | |
# restart.god | |
module God |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# Template for apache config that uses expiry headers, gzip compression and etags | |
# Mainly aimed at Rails apps that run on passenger but I could use this everywhere else | |
<VirtualHost *:80> | |
ServerName servername.com | |
ServerAlias servername.com | |
DocumentRoot /var/rails/servername.com/public | |
SetOutputFilter DEFLATE | |
<Directory "/var/rails/servername.com/current/public"> |