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
# forked from http://kray.jp/blog/rails3-fileupload/ | |
def _store_upload(file) | |
if request.xhr? | |
if request.body.size == request.headers['CONTENT_LENGTH'].to_i | |
file_data = request.body.read | |
file_name = file | |
end | |
else | |
if file.instance_of?(File) | |
file_data = file.read |
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
@get_current_position = () => | |
navigator.geolocation.getCurrentPosition @nearby_places, @failed_alert | |
@nearby_places = (position) => | |
res = $.getJSON "/places/nearby.json", { lat: position.coords.latitude, long: position.coords.longitude }, | |
(json) -> | |
Gmaps.map.replaceMarkers json | |
@failed_alert = () => | |
alert "failed to get current position." |
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 'rubygems' | |
require 'net/http' | |
Net::HTTP.version_1_2 | |
require 'json' | |
class BitLy | |
def initialize(params={}) | |
@base_query = "version=2.0.1&login=#{params[:id]}&apiKey=#{params[:api_key]}" | |
end |
NewerOlder