http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
http://guides.rubyonrails.org/migrations.html
var gulp = require('gulp'); | |
var connect = require('gulp-connect'); | |
var modRewrite = require('connect-modrewrite'); | |
var runSequence = require('run-sequence'); | |
var shell = require('gulp-shell'); | |
//proxy all requests to /api to localhost:3000 for rails api | |
gulp.task('connect', function(){ | |
connect.server({ | |
root: './app', |
##Userable | |
module Userable | |
def self.included(base) | |
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true | |
base.validate :user_must_be_valid | |
base.alias_method_chain :user, :autobuild | |
base.extend ClassMethods | |
base.define_user_accessors | |
end | |
# db/migrate/20120625030355_add_deleted_at_to_user.rb | |
class AddDeletedAtToUser < ActiveRecord::Migration | |
def change | |
add_column :users, :deleted_at, :time | |
end | |
end |
json.success true | |
json.data do | |
json.auth_token @user.authentication_token | |
json.message "login successful" | |
end |
require "aws-sdk" | |
require "dotenv" | |
require "reduce" | |
Dotenv.load | |
def local_dir; './_site'; end | |
def access_key; ENV['AWS_ACCESS_KEY']; end | |
def secret_key; ENV['AWS_SECRET_KEY']; end |
class UrlValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
valid = begin | |
URI.parse(value).kind_of?(URI::HTTP) | |
rescue URI::InvalidURIError | |
false | |
end | |
unless valid | |
record.errors[attribute] << (options[:message] || "is an invalid URL") |
Run this from an ec2 instance in the us-west-1 region.
It will create two queues and feed messages into the first queue with a timestamp, this message will then be read and the difference between the message timestamp and the current time computed and pushed into a response queue. Reading these times will give you the latency between publishing to a queue and receiving the message.
#!/usr/bin/env python | |
############################################################################### | |
# This script downloads an object from AWS S3. If the object was encrypted, | |
# it will be decrypted on the client side using KMS envelope encryption. | |
# | |
# Envelope encryption fetches a data key from KMS and uses it to encrypt the | |
# file. The encrypted file is uploaded to an S3 bucket along with an encrypted | |
# version of the data key (it's encrypted with a KMS master key). You must | |
# have access to the KMS master key to decrypt the data key and file. To | |
# decrypt, the file is downloaded to the client, the encrypted data key is |