This file contains hidden or 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
<%= form_for @location, :html => {:multipart => true} do |f| %> | |
<p> | |
<label>Photo</label> | |
<%= image_tag(@location.photo_url) if @location.avatar? %> | |
<%= f.file_field :photo %> | |
<%= f.hidden_field :photo_cache %> | |
</p> | |
<% end %> |
This file contains hidden or 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
CarrierWave.configure do |config| | |
bucket = case Rails.env | |
when "development" then "hcadirectory-dev" | |
when "staging" then "hcadirectory-staging" | |
when "production" then "hcadirectory" | |
end | |
config.fog_credentials = { | |
:provider => 'AWS', |
This file contains hidden or 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
appCache = window.applicationCache; | |
appCache.addEventListener "cached", (event) => | |
# show good message | |
appCache.addEventListener "noupdate", (event) => | |
# show good message | |
appCache.addEventListener "updateready", (event) => | |
# swap out cache and let user know new page available | |
# reload page to get latest | |
appCache.swapCache() | |
appCache.addEventListener "error", (event) => |
This file contains hidden or 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
def login_from_cached_page | |
current_user_id = params[:current_user_id] | |
# don't login based on parameter from offline page unless there is NO current user | |
if current_user.nil? | |
cu = User.find(current_user_id) | |
sign_in :user, cu | |
message = "current user not logged in" | |
else | |
message = "current user already logged in" | |
end |
This file contains hidden or 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
Kitfox::Application.routes.draw do | |
offline = Rails::Offline.configure :cache_interval => 30 do | |
cache_buster_timestamp = "20120429" | |
files = Dir[ | |
"#{root}/**/*.html", | |
"#{root}/stylesheets/**/*.css", | |
"#{root}/javascripts/**/*.js", | |
"#{root}/images/**/*.*"] | |
files.each do |file| |
This file contains hidden or 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
# In order for the application.manifest to work on the offline capable page, we cannot have rails | |
# add the cache busting timestamp because we can't pass that to rack offline which creates the application.manifest | |
# so for offline we set our own cache busting datestamp that we also set in rack-offline so the manifest will match the | |
# assets in the page | |
# for all other pages utilize regular rails cache busting time stamp | |
# kdh | |
require 'action_view/helpers/asset_tag_helper' | |
module ActionView |
This file contains hidden or 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 Answer < ActiveRecord::Base | |
validate :check_answer_validity | |
def check_answer_validity | |
raw_answer = self.answer_before_type_cast | |
answer_type = Question.find($question_id).answer_type | |
# first test the answer against the corresponding regex | |
case answer_type |
This file contains hidden or 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
Last login: Wed Feb 2 15:38:02 on console | |
[15:45:40]~$ open http://www.atmos.org/cinderella/ | |
[15:45:42]~$ curl https://github.com/atmos/cinderella/raw/master/bootstrap.sh \ | |
> -o - | sh | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
102 1333 102 1333 0 0 1462 0 --:--:-- --:--:-- --:--:-- 12342 | |
Ensuring we have the latest version of cinderella installed | |
A first time install takes about 45 minutes on a modern machine | |
Password: |
This file contains hidden or 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
countdown = function() { | |
var index; | |
function log(){ | |
console.log(index); | |
} | |
function iterate(){ | |
log(); | |
if(index>1) setTimeout(iterate, 1000); |