Skip to content

Instantly share code, notes, and snippets.

View walter's full-sized avatar

Walter McGinnis walter

View GitHub Profile
# for now, only run if we have a clean slate
def self.load_from_apis_for_jurisdiction(abbreviation)
return if self.in(abbreviation).count > 0
api_parse(results_for_jurisdiction(abbreviation)).map do |attributes|
create_from_apis attributes
end
end
def self.create_from_apis(attributes, options = {})
setting = SystemSetting.find_by_name('Maximum Uploaded File Size')
@walter
walter / find_image_sizes.rb
Created July 11, 2013 21:38
How to get the system setting for image sizes setting.
setting = SystemSetting.find_by_name('Image Sizes')
@walter
walter / kete_backgroundrb_and_zebra_boot
Created July 2, 2013 19:36
Debian based on boot Kete supporting processes.
#!/bin/bash
### BEGIN INIT INFO
# Provides: kbzb
# Required-Start: $mysql $all
# Required-Stop: $mysql
# Default-Start: 2
# Default-Stop:
# Short-Description: Reboot all Backgroundrb and Zebra for Kete instances
### END INIT INFO
nextStep = (event) ->
button = event.delegateTarget
steps = $(button).attr('data-relevant-steps').split(', ')
currentStep = $(button).attr 'data-current-step'
currentStepId = stepId(currentStep)
currentStepIndex = steps.indexOf(currentStep)
nextStepIndex = currentStepIndex + 1
nextStepName = steps[nextStepIndex]
nextStepId = stepId(nextStepName)
<%= render 'shared/navigation' %>
<section class="question ask">
<%= form_for @question, url: questions_path(@state_code), validate: true, html: { accept_charset: 'utf-8' } do |f| %>
<%= f.hidden_field :user_id if user_signed_in? %>
<%= f.hidden_field :person_id %>
<%= f.validate :person_id %>
<% locals = { question: @question, person: @person, relevant_steps: @relevant_steps, first_step: @first_step, f: f } -%>
<% @relevant_steps.each do |step| %>
allowed_attributes = [:full_name, :photo_url, :party]
needed_methods = [:id, :most_recent_chamber_title, :most_recent_district]
respond_with @people.as_json({ only: allowed_attributes, methods: needed_methods })
# Customize to your needs...
# export PATH=...
source $HOME/.zshenv
# suck in stuff for backwards compatibility
source $HOME/.profile
plugins=(brew bundler capistrano coffee cp gem git git-remote-branch github heroku osx pow powder rails3)
(setenv "ESHELL" "/usr/local/bin/zsh")
(setenv "SHELL" "/usr/local/bin/zsh")