http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| require 'sinatra' | |
| enable :sessions | |
| #cf: http://rack.rubyforge.org/doc/Rack/Session/Cookie.html | |
| class Visits | |
| @@global = 0 | |
| def self.global; @@global; end | |
| def self.add | |
| @@global +=1 | |
| end |
| # Some good references are: | |
| # http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
| # http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
| # http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
| #1. Install PostgreSQL postgis and postgres | |
| brew install postgis | |
| initdb /usr/local/var/postgres | |
| pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
http://guides.rubyonrails.org/migrations.html
| class RingBuffer < Array | |
| attr_reader :max_size | |
| def initialize(max_size, enum = nil) | |
| @max_size = max_size | |
| enum.each { |e| self << e } if enum | |
| end | |
| def <<(el) | |
| if self.size < @max_size || @max_size.nil? |
| require "sinatra/base" | |
| require "sinatra/namespace" | |
| require "multi_json" | |
| require "api/authentication" | |
| require "api/error_handling" | |
| require "api/pagination" | |
| module Api | |
| class Base < ::Sinatra::Base |
| # ... | |
| desc "Deploy website to s3/cloudfront via aws-sdk" | |
| task :s3_cloudfront => [:generate, :minify, :gzip, :compress_images] do | |
| puts "==================================================" | |
| puts " Deploying to Amazon S3 & CloudFront" | |
| puts "==================================================" | |
| # setup the aws_deploy_tools object | |
| config = YAML::load( File.open("_config.yml")) |
| class LocalResource | |
| attr_reader :uri | |
| def initialize(uri) | |
| @uri = uri | |
| end | |
| def file | |
| @file ||= Tempfile.new(tmp_filename, tmp_folder, encoding: encoding).tap do |f| | |
| io.rewind |
| 'use strict' | |
| angular.module('uploadApp', [ | |
| 'flow' | |
| 'ngJcrop' | |
| ]).config [ | |
| 'flowFactoryProvider' | |
| 'ngJcropConfigProvider' | |
| (flowFactoryProvider, ngJcropConfigProvider) -> |
| #!/bin/bash | |
| killall Xcode | |
| xcrun -k | |
| xcodebuild -alltargets clean | |
| rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
| rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
| rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
| rm -rf ~/Library/Caches/com.apple.dt.Xcode/* | |
| open /Applications/Xcode.app |