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
SOA | |
===================================== | |
Pitr | |
works at Uken Games (team of about 20 people) doing MMO mobile games | |
been there for about a year | |
Noticed things were not DRY | |
refactored common elements from existing games: | |
authentication | |
payments |
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
:plain | |
<div id="disqus_thread"></div> | |
<script type="text/javascript"> | |
/** | |
* var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread] | |
*/ | |
(function() { | |
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | |
dsq.src = '<SOURCE.JS>'; | |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); |
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
status_codes = [['OK',200], ['Created', 201], | |
['Accepted', 202], ['Moved Permanently', 301], | |
['Found', 302], ['Not Modified', 304]] | |
# Create Hash via inject | |
status_codes.inject({}) do |result, (description, value)| | |
key = description.downcase.gsub(' ','_') | |
result[key] = value | |
result # Explicit return of the hash | |
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
Current edit.html.erb: | |
<h2>Editing a ticket in <%= @project.name %></h2> | |
<%= form_for [@project, @ticket] do |f| %> | |
<%= render "form" %> | |
<% end %> | |
Proposed change: | |
<h2>Editing a ticket in <%= @project.name %></h2> | |
<%= render "form" %> |
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
# How to give your devise controllers all the same layout (e.g. "authentication" below) | |
class ApplicationController < ActionController::Base | |
layout :setup_layout | |
protected | |
def setup_layout | |
devise_controller? ? "authentication" : "application" | |
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
# Place the following in the server block | |
if (-f $request_filename) { | |
break; | |
} | |
if (-f $document_root/cache/$uri/index.html) { | |
rewrite (.*) /cache/$1/index.html break; | |
} | |
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
desc "Generate and deploy assets" | |
task :deploy_assets, :roles => :app do | |
# get the previous timestamp | |
old_timestamp = File.read("config/deploy_timestamp").to_i rescue 0 | |
# generate timestamp into config/deploy_timestamp | |
timestamp = Time.now.to_i | |
File.open("config/deploy_timestamp", 'w') do |f| | |
f.write(timestamp) | |
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
require "integrity" | |
Integrity.new(File.dirname(__FILE__) + "/config.yml") | |
project = Integrity::Project.first(:name => "Project Foo") | |
unless `git ls-remote #{project.uri}`.include?(project.commits.last) | |
project.build | |
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
# sexy_template.rb | |
# by Kevin Faustino | |
# Delete all unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/robots.txt" | |
run "rm -f public/images/*" | |
run "rm -f public/javascripts/*" |