This file contains 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
#put all the shared bits in: config/environments/productionable.rb | |
YourApp::Application.configure do | |
config.assets.compile = false | |
config.serve_static_assets = false | |
end | |
This file contains 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
public class StreamResourceProvider : LinkedResourceProvider{ | |
/// <summary> | |
/// Gets a linked resource given its Id and FilePath | |
/// </summary> | |
public override LinkedResource Get(string contentId, string filePath){ | |
var stream = GetYourStream(contentId, filePath); | |
return new LinkedResource(stream); | |
} | |
private Stream GetYourStream(contentId, filePath){ |
This file contains 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 ExportController < ApplicationController | |
def index | |
#suitable for streaming data, no caching http://wiki.nginx.org/X-accel#X-Accel-Buffering | |
headers['X-Accel-Buffering'] = 'no' | |
headers["Cache-Control"] ||= "no-cache" | |
headers.delete("Content-Length") | |
headers["Content-Type"] = "text/csv" | |
headers["Content-disposition"] = 'attachment; filename="gaga.csv"' |
This file contains 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
#clean up the existing files | |
rm -rf pkg tmp/cache public/assets | |
bundle exec rake build_package |
This file contains 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
url\("*\s*\/images\/([^"^)]*)"*\s*\) | |
url(<%= asset_path '\1' %>) |
This file contains 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
$ ls -al /app/realtime/releases | |
current --> 20120729083021 | |
20120722101234 | |
20120603134509 |
This file contains 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 ExampleController < ApiController | |
def index | |
data = Sale.realtime_data | |
#get the timestamp of this deployment | |
server_token = File.basename(Rails.root.to_s) | |
respond_with(data: data, server_token: server_token) | |
end |
This file contains 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
apiModule = { | |
get: function(url, callback, errorCallback) { | |
return $.ajax({ | |
url: url, | |
success: function(response) { | |
if(isNewServerToken(response.server_token)){ | |
reloadPage(); | |
} | |
else{ |
This file contains 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 ExampleController < ApplicationController | |
def index | |
data = Sale.example_data | |
server_token = Rails.root.to_s | |
respond_with {data: data, server_token: server_token} | |
end | |
end |
This file contains 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
apiModule = { | |
get: function(url, callback, errorCallback) { | |
return $.ajax({ | |
url: url, | |
success: function(response) { | |
if(isNewServerToken(response.serverToken)){ | |
reloadPage() | |
} | |
else{ |