rails new my_app --rc=template.rc -m template.rb
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
defmodule RequestCache do | |
@moduledoc """ | |
Simple ETS-based cache. | |
""" | |
use GenServer | |
@type t :: %{ttl: integer, invalidators: %{}} | |
@type cache_key :: any | |
@type cache_value :: any |
defmodule MyApp.Foo do | |
@on_definition MyApp.SpecToCallback | |
@spec bar(String.t()) :: String.t() | |
def bar(foobar) do | |
impl().bar(foobar) | |
end | |
defp impl, do: Application.get_env(:my_app, :my_app_foo_impl, __MODULE__.DefaultImpl) | |
end |
# Step 1 | |
def create_subscription(email, plan_id, payment_method_id) do | |
with %User{customer_id: nil, name: name} = user <- | |
Repo.get_by(User, email: email), | |
{:ok, %Stripe.Customer{id: customer_id}} <- | |
Stripe.Customer.create(%{ | |
name: name, | |
email: email, | |
payment_method: payment_method_id, |
class EventCell < UITableViewCell | |
IDENTIFIER = 'EventCell' | |
PADDING = 10 | |
LEFT_MARGIN = 40 | |
RIGHT_MARGIN = 20 | |
attr_reader :event | |
def initWithStyle(style, reuseIdentifier: reuse_identifier) | |
super.tap do |cell| |
#WARNING do not load this file in environments other than test | |
module AfterCommitPatch | |
def transaction(options = {}) | |
rolled_back = false | |
return_value = nil | |
begin | |
return_value = super | |
rescue ActiveRecord::Rollback => e | |
puts e.message | |
puts e.backtrace |
This is all based on the [alpha release][1].
From the built-in help system:
For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).
These are simple setting = value listings where the value is a format string in which other variables can be referenced.
Do not use rvm (or install and run from JRuby). The google-appengine gem must install into your system MRI. The appengine-sdk gem includes a complete Java app server. We bootstrap Java from MRI, then your app runs inside a servlet container (with access to all the APIs) using the version of JRuby installed into each app.
We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.x calls to rubygems, and now we have it working. Rails 2.3.x currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.
See the TInyDS version also: gist.github.com/gists/269075
# Critical default settings: | |
disable_system_gems | |
disable_rubygems | |
bundle_path '.gems/bundler_gems' | |
# List gems to bundle here: | |
gem 'rails_dm_datastore' | |
gem 'rails', "2.3.5" | |
# Needed for Devise-Plugin |