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
require "config/environment" | |
count = Rim.count | |
Rim.all.each_with_index do |rim, i| | |
if rim.rim_photo.file? | |
puts "rim #{i} of #{count} +" | |
rim.photo = File.open((Rails.root.to_s + '/public' + rim.rim_photo.url).split("?").first) | |
rim.save | |
else | |
puts "rim #{i} of #{count} -" |
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
function nestCollection(model, attributeName, nestedCollection) { | |
//setup nested references | |
for (var i = 0; i < nestedCollection.length; i++) { | |
model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
} | |
//create empty arrays if none | |
nestedCollection.bind('add', function (initiative) { | |
if (!model.get(attributeName)) { | |
model.attributes[attributeName] = []; |
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
Backbone.Model::nestCollection = (attributeName, nestedCollection) -> | |
#setup nested references | |
for item, i in nestedCollection | |
@attributes[attributeName][i] = nestedCollection.at(i).attributes | |
#create empty arrays if none | |
nestedCollection.bind 'add', (initiative) => | |
if !@get(attributeName) | |
@attributes[attributeName] = [] | |
@get(attributeName).push(initiative.attributes) |
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
# Because we have some old legacy users in the database, we need to | |
# override #has_secure_passwords' method for checking if a password is valid. | |
# We first ask if the password is valid, and if it throws an InvalidHash | |
# exception, we know that we're dealing with a legacy user, so we check the | |
# password against the SHA1 algorithm that was used to hash the password in | |
# the old database. | |
#SOURCES OF SOLUTION: | |
# http://stackoverflow.com/questions/6113375/converting-existing-password-hash-to-devise | |
# https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/crypto_providers/sha512.rb |
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
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
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
post: -> | |
patientJSON = @toJSON() | |
patientJSON['responses'] = {} | |
for response in @responses().all() | |
patientJSON['responses'][response.question_id] = response.toJSON()['answer'] | |
# looks weird, cause a Question has a 'question' attribute. | |
patientJSON['responses'][response.question_id]['question'] = response.question.question | |
$.post 'http://thenumbercreative.com/regurgitate_data', patientJSON |
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
$sprites: sprite-map("sprites/*.png"); | |
$sprites-retina: sprite-map("sprites-retina/*.png"); | |
@mixin sprite-background($name) { | |
background-image: sprite-url($sprites); | |
background-position: sprite-position($sprites, $name); | |
background-repeat: no-repeat; | |
display: block; | |
height: image-height(sprite-file($sprites, $name)); | |
width: image-width(sprite-file($sprites, $name)); |
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 map_image(lat, lng, options = {}) | |
options[:zoom] ||= '14' | |
options[:dimensions] ||= '125x125' | |
options[:sensor] ||= false | |
options[:scale] ||= '1' # Pixel density, '2' for Retina. | |
options[:marker_size] ||= 'small' | |
options[:alt] ||= '' | |
url = "http://maps.googleapis.com/maps/api/staticmap?size=#{options[:dimensions]}&zoom=#{options[:zoom]}&sensor=#{options[:sensor]}&markers=size:#{options[:marker_size]}|#{lat},#{lng}" |
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
# This assumes you use sass requires for css, not sprockets. | |
guard 'livereload' do | |
watch(%r{app/.+\.(erb|haml)}) | |
watch(%r{app/helpers/.+\.rb}) | |
watch(%r{app/assets/stylesheets/(.+\.css).*$}) { |m| "assets/#{m[1]}" } | |
watch(%r{app/assets/javascripts/(.+\.js).*$}) { |m| "assets/#{m[1]}" } | |
watch(%r{(app|vendor)/assets/.+\.(sass|scss)}) { '/assets/all/application.css' } | |
watch(%r{public/.+\.(css|js|html)}) | |
watch(%r{config/locales/.+\.yml}) |
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
<div id='background'> | |
<div id='foreground'> | |
Here we have a foreground object. | |
</div> | |
</div> |
OlderNewer