layout | title | date | categories |
---|---|---|---|
post |
Shell Set-up Scripts |
2015-04-29 10:44:01 -0700 |
bash setup api-client |
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
CREATE TABLE expenses ( | |
Id SERIAL PRIMARY KEY NOT NULL, | |
TrxDate DATE DEFAULT now(), | |
PaymentType VARCHAR(100) NOT NULL, | |
Location VARCHAR(100) NOT NULL, | |
What VARCHAR(250) NOT NULL, | |
CategoryType INTEGER NOT NULL REFERENCES categories (Id), | |
Amount NUMERIC(9,2) NOT NULL, | |
Description TEXT NULL, | |
CONSTRAINT amount_greater_than_zero CHECK (Amount > 0) |
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
#list all tasks | |
rake -T | |
#list tasks starting with... | |
rake -T import | |
#get documentation |
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
angular.module('gridtest', [ | |
'ui.router', | |
'ngAnimate', | |
'ngTouch', | |
'ui.grid', | |
'ui.grid.edit', | |
'ui.grid.selection', | |
'ui.grid.moveColumns', | |
'ui.bootstrap', | |
'ui.router' |
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
angular.module('angularails.articles', []) | |
.service('Articles', function(Restangular) { | |
var articles = Restangular.all('articles'); | |
return { | |
all: function() { | |
return articles.getList(); | |
}, | |
show: function(article) { | |
return articles.get(article); |
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
// Gruntfile.js | |
// Generated on 2014-07-18 using generator-angular 0.9.5 | |
'use strict'; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' | |
// use this if you want to recursively match all subfolders: | |
// 'test/spec/**/*.js' |
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 'roo' | |
require 'spreadsheet' | |
namespace :finance do | |
task :import, [:sheet] => [:environment] do |t, args| | |
excel = File.join Rails.root, 'lib', 'assets', 'Ledger.xlsx' | |
book = Roo::Excelx.new(excel) | |
worksheet = book.sheet args[:sheet].to_i |
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 Testcase < ActiveRecord::Base | |
require 'spreadsheet' | |
def self.import(file) | |
spreadsheet = open_spreadsheet(file) | |
header = spreadsheet.row(1) | |
(2..spreadsheet.last_row).each do |i| | |
row = Hash[[header, spreadsheet.row(i)].transpose] | |
testcase = find_by_id(row["id"]) || new | |
testcase.attributes = row.to_hash.slice(*row.to_hash.keys) |
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
source 'https://rubygems.org' | |
gem 'rails', '4.0.2' | |
gem "bower-rails", "~> 0.8.3" | |
gem 'pg' | |
gem 'twitter' | |
gem 'rails_12factor', group: :production | |
gem 'sass-rails', '~> 4.0.0' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.0.0' |
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 DeviseCreateUsers < ActiveRecord::Migration | |
def change | |
create_table(:users) do |t| | |
## Database authenticatable | |
t.string :name | |
t.string :email, :null => false, :default => "" | |
t.string :encrypted_password, :null => false, :default => "" | |
## Recoverable | |
t.string :reset_password_token |