Skip to content

Instantly share code, notes, and snippets.

View maebeale's full-sized avatar

maebeale

  • RTP/Ithaca/Glens Falls/Traverse City/DC
View GitHub Profile
how to create rake task for importing from md (on web)
1. add new *.rake file to lib/tasks folder
2. add new task(s) via task method & pass it a block
a. add dependencies to show order, like this:
task :taskname1 do
dsfdfs
end
@maebeale
maebeale / rakefile-refactor-draft
Created July 15, 2014 02:48
rakefile refactor draft
namespace :books do #TODO create cron on heroku for regularly scheduled refreshes of data
desc 'Rake task to get books file from web'
task :getlivefile => :environment do
open('https://raw.githubusercontent.com/vhf/free-programming-books/master/free-programming-books.md',
'User-Agent' => 'freeshelf_app') do |free_books|
rake books:parsefile #TODO will this line work???
end #TODO ck it out: http://stackoverflow.com/questions/577944/how-to-run-rake-tasks-from-within-rake-tasks
end
desc 'Rake task to get local books file'
export PS1="\[\e[00;34m\]\w\[\e[0m\]\[\e[00;37m\]\\$ \[\e[0m\]"
### HISTORY CONTROL
export HISTCONTROL="erasedups"
shopt -s histappend
export HISTFILESIZE=50000
export HISTSIZE=9999
export HISTIGNORE="&:[ ]*:exit:quit:bg:fg"
### GIT PROMPT
@maebeale
maebeale / battleship.md
Last active August 29, 2015 14:13
battleship game
# SQL challenge #6
# find authors who have no surveys
# In Rails:
Survey.where(author_id :1).empty?
-OR-
a = Author.find(1)
a.surveys.empty?
a.surveys.any?