cheatly 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 421926d9ff00815422d160384717b4662abf87a7
4
- data.tar.gz: 9c59d3a7dc556d9d590303257a3f92bcec4bdac8
3
+ metadata.gz: 32818231558e1e9a89f45882f281f5c462842e31
4
+ data.tar.gz: 910657b9200ab0887056f9f16595062435b799c6
5
5
  SHA512:
6
- metadata.gz: 85f518f577e4c910a5e3ffd815bb23d93406c2fbb04a1665f98012408cd51439827aece7acefa34d8ddb1f6da20f010c1983ba21b0ddce9a0a9f387f9bb60f98
7
- data.tar.gz: c1691f0f69cae08f3963fde38a5ebde04a8ceaf84fe782c63e77a3f9587ab1764a380b05b7d90086ed95fe5dcf51ceeaed6c21f9d895bb7d7713882aaa447fc6
6
+ metadata.gz: 8421f12bdc98568b06cc20c8781a2c08505de2611b70034f970db0a53dd0505d7420811fe68ae659edbb42fb55250f5f517c2b12bbd9b14d9c34fd3c89c6f409
7
+ data.tar.gz: 6b31f06c615b0930ae1941dc9765c8938bd3d80998f0ccafd589d3d674c3452e706863e6f7f4c7e7490c988dbaee5f6514b42400f02a720622c86a45d32a1271
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Cheatly
2
2
 
3
3
  [![Build Status](https://travis-ci.org/arthurnn/cheatly.png?branch=master)](https://travis-ci.org/arthurnn/cheatly)
4
+ [![Code Climate](https://codeclimate.com/github/arthurnn/cheatly.png)](https://codeclimate.com/github/arthurnn/cheatly)
4
5
 
5
6
  This is a command line toolset to handle the cheat-sheets reposity located at [sheets](https://github.com/arthurnn/cheatly/tree/master/sheets) folder.
6
7
 
data/cheatly.gemspec CHANGED
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "octokit", "~> 2.6.1"
21
+ spec.add_dependency "octokit", "~> 2.7.1"
22
22
  spec.add_dependency "pager", "~> 1.0.1"
23
+ spec.add_dependency "redcarpet", "~> 3.0.0"
24
+ spec.add_dependency "colorize", "~> 0.6.0"
23
25
  spec.add_dependency "thor", "~> 0.18.1"
24
26
 
25
27
  spec.add_development_dependency "bundler", ">= 1.3"
@@ -5,25 +5,23 @@ module Cheatly
5
5
  module Adapter
6
6
  class File
7
7
  def find(name)
8
- path = "sheets/#{name}.yml"
9
- sheet_yaml = ::File.read(path)
10
- yml = YAML.load(sheet_yaml).first
11
- [yml.first, yml.last]
8
+ path = "sheets/#{name}.md"
9
+ ::File.read(path)
12
10
  end
13
11
 
14
12
  def all
15
- Dir["sheets/*.yml"].map { |f| f.scan(/sheets\/(.*).yml/)[0][0] }
13
+ Dir["sheets/*.md"].map { |f| f.scan(/sheets\/(.*).md/)[0][0] }
16
14
  end
17
15
 
18
16
  def create(name, body)
19
17
  body = {name => body}.to_yaml
20
- f = ::File.new("sheets/#{name}.yml", "w")
18
+ f = ::File.new("sheets/#{name}.md", "w")
21
19
  f.write(body)
22
20
  f.close
23
21
  end
24
22
 
25
23
  def update(name, body)
26
- ::File.delete("sheets/#{name}.yml")
24
+ ::File.delete("sheets/#{name}.md")
27
25
  create(name, body)
28
26
  end
29
27
  end
@@ -10,10 +10,8 @@ module Cheatly
10
10
  REPO = 'arthurnn/cheatly'
11
11
 
12
12
  def find(path)
13
- response = Octokit.contents(REPO, path: "#{FOLDER}/#{path}.yml")
14
- sheet_yaml = Base64.decode64(response.content)
15
- yml = YAML.load(sheet_yaml).first
16
- [yml.first, yml.last]
13
+ response = Octokit.contents(REPO, path: "#{FOLDER}/#{path}.md")
14
+ Base64.decode64(response.content)
17
15
  end
18
16
 
19
17
  def all
data/lib/cheatly/cli.rb CHANGED
@@ -1,10 +1,13 @@
1
+ require "pager"
2
+ require "optparse"
3
+ require "redcarpet"
4
+ require "thor"
5
+
1
6
  require "cheatly/version"
2
7
  require "cheatly/sheet"
3
8
  require "cheatly/adapter/file"
4
9
  require "cheatly/adapter/github"
5
-
6
- require "pager"
7
- require "thor"
10
+ require "cheatly/renderer"
8
11
 
9
12
  module Cheatly
10
13
  class CLI < Thor
@@ -20,8 +23,9 @@ module Cheatly
20
23
  return
21
24
  end
22
25
  page
23
- puts "#{sheet.title}:"
24
- puts sheet.to_s
26
+ renderer = Renderer.new
27
+ md = Redcarpet::Markdown.new(renderer, no_intra_emphasis: true)
28
+ puts md.render(sheet.to_s)
25
29
  end
26
30
 
27
31
  desc "list sheets", "list all available sheets"
@@ -53,29 +57,35 @@ module Cheatly
53
57
  show('help')
54
58
  end
55
59
 
60
+ desc "version", "Prints cheatly's version"
61
+ def version
62
+ puts "Cheatly version #{Cheatly::VERSION}"
63
+ end
64
+ map %w(-v --version) => :version
65
+
56
66
  private
57
67
 
58
- def model
59
- if options[:local]
60
- Sheet.with_file_adapter
61
- else
62
- Sheet
68
+ def model
69
+ if options[:local]
70
+ Sheet.with_file_adapter
71
+ else
72
+ Sheet
73
+ end
63
74
  end
64
- end
65
75
 
66
- def write_to_tempfile(title, body = nil)
67
- tempfile = Tempfile.new(title + '.yml')
68
- tempfile.write(body) if body
69
- tempfile.close
70
- system "#{editor} #{tempfile.path}"
71
- tempfile.open
72
- body = tempfile.read
73
- tempfile.close
74
- body
75
- end
76
+ def write_to_tempfile(title, body = nil)
77
+ tempfile = Tempfile.new(title + '.yml')
78
+ tempfile.write(body) if body
79
+ tempfile.close
80
+ system "#{editor} #{tempfile.path}"
81
+ tempfile.open
82
+ body = tempfile.read
83
+ tempfile.close
84
+ body
85
+ end
76
86
 
77
- def editor
78
- ENV['VISUAL'] || ENV['EDITOR'] || "nano"
79
- end
87
+ def editor
88
+ ENV['VISUAL'] || ENV['EDITOR'] || "nano"
89
+ end
80
90
  end
81
91
  end
@@ -0,0 +1,62 @@
1
+ require "colorize"
2
+
3
+ module Cheatly
4
+ class Renderer < Redcarpet::Render::Base
5
+ def normal_text(text)
6
+ text
7
+ end
8
+
9
+ def block_code(code, language = nil)
10
+ code = code.each_line
11
+ code = code.map { |l| " #{l}" }
12
+ "\n#{code.join}\n"
13
+ end
14
+
15
+ def codespan(code)
16
+ "`#{code}`"
17
+ end
18
+
19
+ def header(title, level)
20
+ sep = case level
21
+ when 1 then '='
22
+ when 2 then '+'
23
+ when 3 then '-'
24
+ end
25
+
26
+ "\n#{title.bold}\n#{(sep * title.length).bold}\n"
27
+ end
28
+
29
+ def double_emphasis(text)
30
+ text.bold
31
+ end
32
+
33
+ def emphasis(text)
34
+ text.underline
35
+ end
36
+
37
+ def paragraph(text)
38
+ "#{text}\n"
39
+ end
40
+
41
+ def linebreak
42
+ "\n"
43
+ end
44
+
45
+ def list(content, list_type)
46
+ content
47
+ end
48
+
49
+ def list_item(content, list_type)
50
+ lines = content.each_line
51
+ lines = lines.map { |l| " #{l}" }
52
+ " - #{lines.join.strip}\n"
53
+ end
54
+
55
+ def image(color, bg_color, text)
56
+ text = text.colorize(color: color.to_sym)
57
+ text = text.colorize(background: bg_color.to_sym) if bg_color
58
+
59
+ text
60
+ end
61
+ end
62
+ end
data/lib/cheatly/sheet.rb CHANGED
@@ -4,11 +4,11 @@ module Cheatly
4
4
 
5
5
  def initialize(title, body = nil, options = {})
6
6
  @title, @body = title, body
7
- @presisted = options[:persisted] || false
7
+ @persisted = options[:persisted] || false
8
8
  end
9
9
 
10
10
  def to_s
11
- " #{@body.gsub("\r",'').gsub("\n", "\n ")}"
11
+ body.to_s
12
12
  end
13
13
 
14
14
  def create
@@ -27,9 +27,11 @@ module Cheatly
27
27
  end
28
28
  end
29
29
 
30
- def self.find(handle)
31
- t, b = adapter.find(handle)
32
- Sheet.new(t, b, persisted: true)
30
+ def self.find(name)
31
+ body = adapter.find(name)
32
+ Sheet.new(name, body, persisted: true)
33
+ rescue Octokit::NotFound => e
34
+ nil
33
35
  rescue RuntimeError => e
34
36
  puts e.message
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module Cheatly
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,41 @@
1
+ ## Standard Ruby Assertions
2
+
3
+ assert boolean
4
+ assert_equal expected, actual
5
+ assert_raise *args
6
+ assert_raises *args, &block
7
+ assert_instance_of klass, object
8
+ assert_nil object
9
+ assert_kind_of klass, object
10
+ assert_respond_to object, method
11
+ assert_match pattern, string
12
+ assert_same expected, actual
13
+ assert_operator object1, operator, object2
14
+ assert_nothing_raised *args
15
+ assert_not_same expected, actual
16
+ assert_not_equal expected, actual
17
+ assert_not_nil object
18
+ assert_no_match regexp, string
19
+ assert_throws expected_symbol, &proc
20
+ assert_nothing_thrown &proc
21
+ assert_in_delta expected_float, actual_float, delta
22
+ assert_send send_array
23
+
24
+
25
+ ## Rails Assertions
26
+
27
+ assert_response type
28
+ assert_redirected_to options = {}
29
+ assert_template expected
30
+ assert_recognizes expected_options, path, extras={}
31
+ assert_generates expected_path, options, defaults={}, extras = {}
32
+ assert_routing path, options, defaults={}, extras={}
33
+ assert_tag *opts
34
+ assert_no_tag *opts
35
+ assert_dom_equal expected, actual
36
+ assert_dom_not_equal expected, actual
37
+ assert_valid record
38
+
39
+
40
+ Credit: http://nubyonrails.com/articles/ruby-rails-test-rails-cheat-sheet
41
+ Use `cheat assert_raise` for more details
data/sheets/bash.md ADDED
@@ -0,0 +1,103 @@
1
+ # Bash
2
+
3
+ - `!!` - Last command
4
+ - `!foo` - Run most recent command starting with 'foo...' (ex. !ps, !mysqladmin)
5
+ - `!foo:p` - Print command that `!foo` would run, and add it as the latest to
6
+ command history
7
+ - `!$` - Last 'word' of last command (`/path/to/file` in the command
8
+ `ls -lAFh /path/to/file`, `-uroot` in `mysql -uroot`)
9
+ - `!$:p` - Print word that `!$` would substitute
10
+ - `!*` - All but first word of last command (`-lAFh /path/to/file` in the
11
+ command `ls -lAFh /path/to/file`, `-uroot` in `mysql -uroot`)
12
+ - `!*:p` - Print words that `!*` would substitute
13
+ - `^foo^bar` - Replace `foo` in last command with `bar`, print the result, then
14
+ run. (`mysqladmni -uroot`, run `^ni^in`, results in `mysqladmin -uroot`)
15
+ - `{a,b,c}` passes words to the command, substituting `a`, `b`, and `c`
16
+ sequentially (`cp file{,.bk}` runs `cp file file.bk`)
17
+
18
+ ## Key bindings
19
+ - `Ctrl + a` - Jump to the start of the line
20
+ - `Ctrl + b` - Move back a char
21
+ - `Ctrl + c` - Terminate the command
22
+ - `Ctrl + d` - Delete from under the cursor
23
+ - `Ctrl + e` - Jump to the end of the line
24
+ - `Ctrl + f` - Move forward a char
25
+ - `Ctrl + k` - Delete to EOL
26
+ - `Ctrl + l` - Clear the screen
27
+ - `Ctrl + r` - Search the history backwards
28
+ - `Ctrl + R` - Search the history backwards with multi occurrence
29
+ - `Ctrl + t` - Transpose the current char with the previous
30
+ - `Ctrl + u` - Delete backward from cursor
31
+ - `Ctrl + w` - Delete backward a word
32
+ - `Ctrl + xx` - Move between EOL and current cursor position
33
+ - `Ctrl + x @` - Show possible hostname completions
34
+ - `Ctrl + z` - Suspend/ Stop the command
35
+ - `Ctrl + x`; `Ctrl + e` - Edit line into your favorite editor
36
+ - `Alt + <` - Move to the first line in the history
37
+ - `Alt + >` - Move to the last line in the history
38
+ - `Alt + ?` - Show current completion list
39
+ - `Alt + *` - Insert all possible completions
40
+ - `Alt + /` - Attempt to complete filename
41
+ - `Alt + .` - Yank last argument to previous command
42
+ - `Alt + b` - Move backward
43
+ - `Alt + c` - Capitalize the word
44
+ - `Alt + d` - Delete word
45
+ - `Alt + f` - Move forward
46
+ - `Alt + l` - Make word lowercase
47
+ - `Alt + n` - Search the history forwards non-incremental
48
+ - `Alt + p` - Search the history backwards non-incremental
49
+ - `Alt + r` - Recall command
50
+ - `Alt + t` - Transpose the current word with the previous
51
+ - `Alt + u` - Make word uppercase
52
+ - `Alt + back-space` - Delete backward from cursor
53
+
54
+ ## Completion
55
+ (Here "2T" means Press TAB twice)
56
+ $ 2T - All available commands(common)
57
+ $ (string)2T - All available commands starting with (string)
58
+ $ /2T - Entire directory structure including hidden one
59
+ $ (dir)2T - Only Sub Dirs inside (dir) including Hidden one
60
+ $ *2T - Only Sub Dirs inside without Hidden one
61
+ $ ~2T - All Present Users on system from \"/etc/passwd\"
62
+ $ $2T - All Sys variables
63
+ $ @2T - Entries from "/etc/hosts"
64
+ $ =2T - Output like ls or dir
65
+ .bash_profile = sourced by login shell,
66
+ .bashrc = sourced by all shells,
67
+ .bash_aliases = should be sourced by .bashrc
68
+
69
+ Run something:
70
+
71
+ for i in a b c; do $i 'hello'; done
72
+
73
+ Do something on a bunch of files:
74
+
75
+ for i in *.rb; do echo "$i"; done
76
+
77
+ If syntax:
78
+
79
+ if [[ -e .ssh ]]; then echo "hi"; fi
80
+
81
+ Numerical comparison:
82
+
83
+ i=0
84
+ if (( i <= 1 )); then
85
+ echo "smaller or equal"
86
+ else
87
+ echo "bigger"
88
+ fi
89
+
90
+ file check flags:
91
+
92
+ -e: file exists
93
+ -f: regular file (non directory)
94
+ -d: directory
95
+ -s: non-zero file
96
+ -x: execute permission
97
+
98
+ Avoid duplicates in your history:
99
+
100
+ export HISTIGNORE="&:ls:ls*:[bf]g:exit"
101
+
102
+ more here:
103
+ <http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/fto.html>
@@ -0,0 +1,34 @@
1
+ # Ruby exceptions
2
+
3
+ * Exception
4
+ - NoMemoryError
5
+ - ScriptError
6
+ + LoadError
7
+ + NotImplementedError
8
+ * SyntaxError
9
+ - SignalException
10
+ + Interrupt
11
+ * Timeout::Error # require 'timeout' for Timeout::Error
12
+ - StandardError # caught by rescue if no type is specified
13
+ + ArgumentError
14
+ + IOError
15
+ * EOFError
16
+ + IndexError
17
+ * LocalJumpError
18
+ + NameError
19
+ * NoMethodError
20
+ + RangeError
21
+ * FloatDomainError
22
+ * RegexpError
23
+ + RuntimeError
24
+ * Timeout::Error # moved here in ruby 1.9.2
25
+ + SecurityError
26
+ + SocketError
27
+ + SystemCallError # Errno::* inherits here
28
+ + SystemStackError
29
+ + ThreadError
30
+ + TypeError
31
+ + ZeroDivisionError
32
+
33
+ + SystemExit
34
+ * fatal
@@ -0,0 +1,63 @@
1
+ # RubyGems release
2
+
3
+ $ gem release your.gemspec # builds the gem and pushes it to
4
+ # rubygems.org
5
+ $ gem release # uses the first *.gemspec in the
6
+ # current working directory
7
+ $ gem release --tag # also executes gem tag
8
+ $ gem release --key KEY # use the specified API key from
9
+ # ~/.gem/credentials
10
+ $ gem release --host HOST # push to a gemcutter-compatible host
11
+ # other than rubygems.org
12
+ $ gem release --quiet # suppress output status messages
13
+ $ gem tag # creates a git tag and pushes to
14
+ # the origin git repository
15
+ $ gem gemspec # generates a [gem_name].gemspec using
16
+ # Dir[\"{lib/**/*,[A-Z]*}\"]
17
+ $ gem gemspec --strategy git # uses s.files = `git ls-files app
18
+ # lib`.split("\\")
19
+ $ gem bootstrap # generates a [gem_name].gemspec using
20
+ # the current directory name
21
+ # and scaffolds
22
+ # lib/[gem_name]/version.rb, README,
23
+ # test/
24
+ $ gem bootstrap your_gem # creates a your_gem directory,
25
+ # bootstraps your_gem and inits a git
26
+ # repo
27
+ $ gem bootstrap --github # inits a git repo, creates it on
28
+ # GitHub and pushes it to github
29
+ # (requires git config for
30
+ # github.user and github.token
31
+ # to be set)
32
+ $ gem bump # Bump the gem version to the next patch or
33
+ # pre-release level (e.g. 0.0.1 to 0.0.2,
34
+ # 1.0.0.pre1 to 1.0.0.pre2, 1.0.0.rc1 to
35
+ # 1.0.0.rc2)
36
+ $ gem bump --version 1.1.1 # Bump the gem version to the given version
37
+ # number
38
+ $ gem bump --version major # Bump the gem version to the next major
39
+ # level (e.g. 0.0.1 to 1.0.0)
40
+ $ gem bump --version minor # Bump the gem version to the next minor
41
+ # level (e.g. 0.0.1 to 0.1.0)
42
+ $ gem bump --version patch # Bump the gem version to the next patch
43
+ # level (e.g. 0.0.1 to 0.0.2)
44
+ $ gem bump --version pre|rc|etc # Bump the gem version to the next
45
+ # pre-release level (e.g. `pre`: 1.0.0.pre1
46
+ # to 1.0.0.pre2, 0.0.1 to 0.0.2.pre1;
47
+ # `beta`: 1.0.0.beta1 to 1.0.0.beta2, 0.0.1
48
+ # to 0.0.2.beta1)
49
+ $ gem bump --push # Bump and push to the origin git repository
50
+ $ gem bump --tag # Bump and tag gem and pushes tags to the
51
+ # origin repository
52
+ $ gem bump --release # Bump and release gem
53
+ $ gem bump --release --key KEY # Bump and release the gem, using the
54
+ # specified API key from ~/.gem/credentials
55
+ $ gem bump --release --host HOST # Bump and release the gem to a
56
+ # gemcutter-compatible host other than
57
+ # rubygems.org
58
+ $ gem bump --release --quiet # Bump and release the gem, suppressing
59
+ # output status messages
60
+ $ gem bump --tag --release # Bump, tag, push and release gem
61
+ $ gem bump --no-commit # Bump the gem version but don't git commit
62
+ # (will be ignored if combined with push,
63
+ # tag or release)
data/sheets/help.md ADDED
@@ -0,0 +1,25 @@
1
+ Cheatly Help
2
+ ============
3
+
4
+ Usage
5
+ -----
6
+
7
+ To list the available
8
+
9
+ cheatly list
10
+
11
+ To see the sheet
12
+
13
+ cheatly show $SHEET_NAME
14
+
15
+ To create a new sheet local:
16
+
17
+ 1. `git clone https://github.com/arthurnn/cheatly.git`
18
+ 2. `cheatly new $SHEET_NAME`
19
+ 3. Create a pull request
20
+
21
+ To see this message
22
+
23
+ cheatly help
24
+
25
+ happy cheating
@@ -0,0 +1,88 @@
1
+ # Rails Migrations
2
+
3
+ ## Methods:
4
+
5
+ create_table(name, options)
6
+ drop_table(name)
7
+ rename_table(old_name, new_name)
8
+ add_column(table_name, column_name, type, options)
9
+ rename_column(table_name, column_name, new_column_name)
10
+ change_column(table_name, column_name, type, options)
11
+ remove_column(table_name, column_name)
12
+ add_index(table_name, column_name, index_type)
13
+ remove_index(table_name, column_name)
14
+ change_table(table_name) { |table| ... }
15
+
16
+ ## Available Column Types (mappings are below):
17
+
18
+ * integer
19
+ * float
20
+ * datetime
21
+ * date
22
+ * timestamp
23
+ * time
24
+ * text
25
+ * string
26
+ * binary
27
+ * boolean
28
+ * decimal
29
+ - precision
30
+ - scale
31
+
32
+ ## Valid Column Options:
33
+
34
+ * limit
35
+ * null (i.e. `null: false` implies NOT NULL)
36
+ * default (to specify default values)
37
+ * precision (only decimal)
38
+ * scale (only decimal)
39
+
40
+ ## Rake Tasks:
41
+
42
+ - rake db:schema:dump: run after you create a model to capture the schema.rb
43
+ - rake db:schema:import: import the schema file into the current database
44
+ (on error, check if your schema.rb has `force: true` on the create table
45
+ statements)
46
+ - rails generate migration (migration name): generate a new migration with
47
+ a new 'highest' version (run 'rails generate migration' for this info at
48
+ your fingertips)
49
+ - rake db:migrate: migrate your current database to the most recent version
50
+ - rake db:migrate VERSION=5: migrate your current database to a specific
51
+ version (in this case, version 5)
52
+ - rake db:rollback: migrate down one migration
53
+ - rake db:rollback STEP=3: migrate down three migrations
54
+ - rake db:migrate RAILS_ENV=production: migrate your production database
55
+
56
+ ## SQL:
57
+
58
+ Queries can be executed directly:
59
+
60
+ execute <<SQL
61
+ ALTER TABLE researchers
62
+ ADD CONSTRAINT fk_researchers_departments
63
+ FOREIGN KEY ( department_id ) REFERENCES departments( id )
64
+ SQL
65
+
66
+ ## Example:
67
+
68
+ class UpdateUsersAndCreateProducts < ActiveRecord::Migration
69
+ def self.up
70
+ rename_column :users, :password:, :hashed_password
71
+ remove_column :users, :email
72
+
73
+ create_table :people do |t|
74
+ t.integer :account_id
75
+ t.string :first_name, :last_name, null: false
76
+ t.text :description
77
+ t.references :category # is the equivalent of t.integer :category_id
78
+ t.timestamps
79
+ end
80
+ end
81
+
82
+ def self.down
83
+ rename_column :users, :hashed_password, :password
84
+ add_column :users, :email, :string
85
+
86
+ drop_table :products
87
+ end
88
+ end
data/sheets/sprintf.md ADDED
@@ -0,0 +1,24 @@
1
+ # `sprintf` formatters
2
+
3
+ %b => Binary integer
4
+ %c => Single character
5
+ %d => Decimal integer
6
+ %e => Decimal integer displayed in exponential form (3e+07)
7
+ %E => Decimal integer displayed in exponential form (3E+07)
8
+ %f => Floating point number
9
+ %g => Same as %e if exponent is less than -4, %f otherwise
10
+ %G => Same as %E if exponent is less than -4, %f otherwise
11
+ %o => Octal integer
12
+ %s => String
13
+ %u => Unsigned decimal integer
14
+ %x => Hexadecimal integer (2a)
15
+ %X => Hexadecimal integer uppercase (2A)
16
+ %02d => 0 padded two digits
17
+ %.02f => round to the hundredths
18
+ %+ => +/- sign
19
+
20
+
21
+ ## Width & alignment
22
+
23
+ "%10s" % "hello" => " hello"
24
+ "%-10s" % "hello" => "hello "
@@ -0,0 +1,70 @@
1
+ # HTTP Response Codes
2
+
3
+ Use these codes for the #head or #render methods. Ex:
4
+
5
+ head :ok
6
+ render :file => '404.html.erb', :status => :not_found
7
+
8
+ ## 1xx Informational
9
+
10
+ 100 => :continue
11
+ 101 => :switching_protocols
12
+ 102 => :processing
13
+
14
+ ## 2xx Success
15
+
16
+ 200 => :ok
17
+ 201 => :created
18
+ 202 => :accepted
19
+ 203 => :non_authoritative_information
20
+ 204 => :no_content
21
+ 205 => :reset_content
22
+ 206 => :partial_content
23
+ 207 => :multi_status
24
+ 226 => :im_used
25
+
26
+ ## 3xx Redirection
27
+
28
+ 300 => :multiple_choices
29
+ 301 => :moved_permanently
30
+ 302 => :found
31
+ 303 => :see_other
32
+ 304 => :not_modified
33
+ 305 => :use_proxy
34
+ 307 => :temporary_redirect
35
+
36
+ ## 4xx Client Error
37
+
38
+ 400 => :bad_request
39
+ 401 => :unauthorized
40
+ 402 => :payment_required
41
+ 403 => :forbidden
42
+ 404 => :not_found
43
+ 405 => :method_not_allowed
44
+ 406 => :not_acceptable
45
+ 407 => :proxy_authentication_required
46
+ 408 => :request_timeout
47
+ 409 => :conflict
48
+ 410 => :gone
49
+ 411 => :length_required
50
+ 412 => :precondition_failed
51
+ 413 => :request_entity_too_large
52
+ 414 => :request_uri_too_long
53
+ 415 => :unsupported_media_type
54
+ 416 => :requested_range_not_satisfiable
55
+ 417 => :expectation_failed
56
+ 422 => :unprocessable_entity
57
+ 423 => :locked
58
+ 424 => :failed_dependency
59
+ 426 => :upgrade_required
60
+
61
+ ## 5xx Server Error
62
+
63
+ 500 => :internal_server_error
64
+ 501 => :not_implemented
65
+ 502 => :bad_gateway
66
+ 503 => :service_unavailable
67
+ 504 => :gateway_timeout
68
+ 505 => :http_version_not_supported
69
+ 507 => :insufficient_storage
70
+ 510 => :not_extended"
data/test/sheet_test.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class SheetTest < MiniTest::Test
4
+ def test_sheet_list
5
+ sheets = Cheatly::Sheet.all
6
+ assert sheets.is_a?(Array)
7
+ assert sheets.any?
8
+ end
9
+
4
10
  def test_sheet_find
5
11
  sheet = Cheatly::Sheet.find("bash")
6
12
  assert sheet
7
13
  end
8
14
 
9
- def test_sheet_list
10
- sheets = Cheatly::Sheet.all
11
- assert sheets.is_a?(Array)
12
- assert sheets.any?
15
+ def test_sheet_not_found
16
+ assert_nil Cheatly::Sheet.find("foo")
13
17
  end
14
18
  end
metadata CHANGED
@@ -1,97 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheatly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Neves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-24 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.1
19
+ version: 2.7.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.6.1
26
+ version: 2.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pager
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.0
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: thor
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ~>
73
+ - - "~>"
46
74
  - !ruby/object:Gem::Version
47
75
  version: 0.18.1
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ~>
80
+ - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: 0.18.1
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: bundler
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - '>='
87
+ - - ">="
60
88
  - !ruby/object:Gem::Version
61
89
  version: '1.3'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - '>='
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
96
  version: '1.3'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - '>='
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
103
  version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - '>='
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: minitest
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - ~>
115
+ - - "~>"
88
116
  - !ruby/object:Gem::Version
89
117
  version: 5.0.8
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - ~>
122
+ - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: 5.0.8
97
125
  description: A cheat-sheet cli for a cheat repository
@@ -102,8 +130,8 @@ executables:
102
130
  extensions: []
103
131
  extra_rdoc_files: []
104
132
  files:
105
- - .gitignore
106
- - .travis.yml
133
+ - ".gitignore"
134
+ - ".travis.yml"
107
135
  - Gemfile
108
136
  - LICENSE.txt
109
137
  - README.md
@@ -115,18 +143,18 @@ files:
115
143
  - lib/cheatly/adapter/file.rb
116
144
  - lib/cheatly/adapter/github.rb
117
145
  - lib/cheatly/cli.rb
146
+ - lib/cheatly/renderer.rb
118
147
  - lib/cheatly/sheet.rb
119
148
  - lib/cheatly/version.rb
120
- - sheets/assertions.yml
121
- - sheets/bash.yml
122
- - sheets/exceptions.yml
123
- - sheets/gem_release.yml
124
- - sheets/help.yml
149
+ - sheets/assertions.md
150
+ - sheets/bash.md
151
+ - sheets/exceptions.md
152
+ - sheets/gem_release.md
153
+ - sheets/help.md
125
154
  - sheets/markdown.yml
126
- - sheets/migrations.yml
127
- - sheets/sprintf.yml
128
- - sheets/status_codes.yml
129
- - sheets/strftime.yml
155
+ - sheets/migrations.md
156
+ - sheets/sprintf.md
157
+ - sheets/status_codes.md
130
158
  - test/sheet_test.rb
131
159
  - test/test_helper.rb
132
160
  homepage: ''
@@ -139,17 +167,17 @@ require_paths:
139
167
  - lib
140
168
  required_ruby_version: !ruby/object:Gem::Requirement
141
169
  requirements:
142
- - - '>='
170
+ - - ">="
143
171
  - !ruby/object:Gem::Version
144
172
  version: '0'
145
173
  required_rubygems_version: !ruby/object:Gem::Requirement
146
174
  requirements:
147
- - - '>='
175
+ - - ">="
148
176
  - !ruby/object:Gem::Version
149
177
  version: '0'
150
178
  requirements: []
151
179
  rubyforge_project:
152
- rubygems_version: 2.1.11
180
+ rubygems_version: 2.2.0
153
181
  signing_key:
154
182
  specification_version: 4
155
183
  summary: A cheat-sheet cli for a cheat repository
@@ -1,19 +0,0 @@
1
- ---
2
- assertions: ! " # Credit: http://nubyonrails.com/articles/ruby-rails-test-rails-cheat-sheet\n
3
- \ # Use 'cheat assert_raise' for more details\n \n # Standard Ruby Assertions\n
4
- \ \n assert boolean \n assert_equal expected, actual
5
- \n assert_raise *args \n assert_raises *args, &block \n assert_instance_of
6
- \ klass, object \n assert_nil object \n assert_kind_of klass,
7
- object \n assert_respond_to object, method \n assert_match pattern,
8
- string \n assert_same expected, actual \n assert_operator object1,
9
- operator, object2 \n assert_nothing_raised *args \n assert_not_same expected,
10
- actual \n assert_not_equal expected, actual \n assert_not_nil object
11
- \n assert_no_match regexp, string \n assert_throws expected_symbol,
12
- &proc \n assert_nothing_thrown &proc \n assert_in_delta expected_float,
13
- actual_float, delta \n assert_send send_array\n \n # Rails Assertions\n
14
- \ \n assert_response type \n assert_redirected_to options = {} \n assert_template
15
- \ expected \n assert_recognizes expected_options, path, extras={}
16
- \n assert_generates expected_path, options, defaults={}, extras = {} \n
17
- \ assert_routing path, options, defaults={}, extras={} \n assert_tag *opts
18
- \n assert_no_tag *opts \n assert_dom_equal expected, actual \n
19
- \ assert_dom_not_equal expected, actual \n assert_valid record "
data/sheets/bash.yml DELETED
@@ -1,45 +0,0 @@
1
- ---
2
- bash: ! " !! - Last command\n !foo - Run most recent command starting with 'foo...'
3
- (ex. !ps, !mysqladmin)\n !foo:p - Print command that !foo would run, and add
4
- it as the latest to\n command history\n !$ - Last 'word' of last command ('/path/to/file'
5
- in the command 'ls -lAFh\n /path/to/file', '-uroot' in 'mysql -uroot')\n !$:p
6
- - Print word that !$ would substitute\n !* - All but first word of last command
7
- ('-lAFh /path/to/file' in the\n command 'ls -lAFh /path/to/file', '-uroot' in
8
- 'mysql -uroot')\n !*:p - Print words that !* would substitute\n \n ^foo^bar
9
- - Replace 'foo' in last command with 'bar', print the result, then\n run. ('mysqladmni
10
- -uroot', run '^ni^in', results in 'mysqladmin -uroot')\n \n {a,b,c} passes words
11
- to the command, substituting a, b, and c sequentially\n (`cp file{,.bk}` runs
12
- `cp file file.bk`)\n \n Ctrl + a - Jump to the start of the line\n Ctrl +
13
- b - Move back a char\n Ctrl + c - Terminate the command\n Ctrl + d - Delete
14
- from under the cursor\n Ctrl + e - Jump to the end of the line\n Ctrl + f
15
- - Move forward a char\n Ctrl + k - Delete to EOL\n Ctrl + l - Clear the screen\n
16
- \ Ctrl + r - Search the history backwards\n Ctrl + R - Search the history backwards
17
- with multi occurrence\n Ctrl + t - Transpose the current char with the previous\n
18
- \ Ctrl + u - Delete backward from cursor\n Ctrl + w - Delete backward a word\n
19
- \ Ctrl + xx - Move between EOL and current cursor position\n Ctrl + x @ - Show
20
- possible hostname completions\n Ctrl + z - Suspend/ Stop the command\n Ctrl
21
- + x; Ctrl + e - Edit line into your favorite editor\n \n Alt + < - Move to the
22
- first line in the history\n Alt + > - Move to the last line in the history\n
23
- \ Alt + ? - Show current completion list\n Alt + * - Insert all possible completions\n
24
- \ Alt + / - Attempt to complete filename\n Alt + . - Yank last argument to
25
- previous command\n Alt + b - Move backward\n Alt + c - Capitalize the word\n
26
- \ Alt + d - Delete word\n Alt + f - Move forward\n Alt + l - Make word lowercase\n
27
- \ Alt + n - Search the history forwards non-incremental\n Alt + p - Search
28
- the history backwards non-incremental\n Alt + r - Recall command\n Alt + t
29
- - Transpose the current word with the previous\n Alt + u - Make word uppercase\n
30
- \ Alt + back-space - Delete backward from cursor\n \n (Here \"2T\" means Press
31
- TAB twice)\n $ 2T - All available commands(common)\n $ (string)2T - All available
32
- commands starting with (string)\n $ /2T - Entire directory structure including
33
- Hidden one\n $ (dir)2T - Only Sub Dirs inside (dir) including Hidden one\n $
34
- *2T - Only Sub Dirs inside without Hidden one \n $ ~2T - All Present Users on
35
- system from \"/etc/passwd\"\n $ $2T - All Sys variables\n $ @2T - Entries
36
- from \"/etc/hosts\"\n $ =2T - Output like ls or dir\n .bash_profile = sourced
37
- by login shell, \n .bashrc = sourced by all shells, \n .bash_aliases = should
38
- be sourced by .bashrc\n \n Run something:\n for i in a b c; do $i 'hello';
39
- done\n \n Do something on a bunch of files:\n for i in *.rb; do echo \"$i\";
40
- done\n \n If syntax:\n if [[ -e .ssh ]]; then echo \"hi\"; fi\n \n Numerical
41
- comparison:\n i=0; if (( i <= 1 )); then echo \"smaller or equal\"; else echo
42
- \"bigger\"; fi\n \n file check flags:\n -e: file exists\n -f: regular
43
- file (non directory)\n -d: directory\n -s: non-zero file\n -x: execute
44
- permission\n \n Avoid duplicates in your history:\n export HISTIGNORE=\"&:ls:ls
45
- *:[bf]g:exit\"\n \n more here:\n \n http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/fto.html"
@@ -1,10 +0,0 @@
1
- ---
2
- exceptions: ! " Exception\r\n NoMemoryError\r\n ScriptError\r\n LoadError\r\n NotImplementedError\r\n
3
- \ SyntaxError\r\n SignalException\r\n Interrupt\r\n Timeout::Error #
4
- require 'timeout' for Timeout::Error\r\n StandardError # caught by rescue
5
- if no type is specified\r\n ArgumentError\r\n IOError\r\n EOFError\r\n IndexError\r\n
6
- \ LocalJumpError\r\n NameError\r\n NoMethodError\r\n RangeError\r\n FloatDomainError\r\n
7
- \ RegexpError\r\n RuntimeError\r\n Timeout::Error # moved here in ruby
8
- 1.9.2\r\n SecurityError\r\n SocketError\r\n SystemCallError # Errno::*
9
- inherits here\r\n SystemStackError\r\n ThreadError\r\n TypeError\r\n ZeroDivisionError\r\n
10
- \ SystemExit\r\n fatal"
@@ -1,45 +0,0 @@
1
- ---
2
- gem_release: ! "$ gem release your.gemspec # builds the gem and pushes it to
3
- rubygems.org\n$ gem release # uses the first *.gemspec in the
4
- current\n # working directory\n$ gem release --tag
5
- \ # also executes gem tag\n$ gem release --key KEY # use the
6
- specified API key from\n # ~/.gem/credentials\n$
7
- gem release --host HOST # push to a gemcutter-compatible host other\n #
8
- than rubygems.org\n$ gem release --quiet # suppress output status messages\n\n$
9
- gem tag # creates a git tag and pushes to the origin\n #
10
- git repository\n\n$ gem gemspec # generates a [gem_name].gemspec
11
- using\n # Dir[\"{lib/**/*,[A-Z]*}\"]\n$ gem gemspec
12
- --strategy git # uses s.files = `git ls-files app\n #
13
- lib`.split(\"\\n\")\n\n$ gem bootstrap # generates a [gem_name].gemspec
14
- using the\n # current directory name and scaffolds\n
15
- \ # lib/[gem_name]/version.rb, README, test/\n$ gem
16
- bootstrap your_gem # creates a your_gem directory, bootstraps\n #
17
- your_gem and inits a git repo\n$ gem bootstrap --github # inits a git repo,
18
- creates it on github and\n # pushes it to github
19
- (requires git config\n # for github.user and github.token
20
- to be set)\n\n$ gem bump # Bump the gem version to the next
21
- patch or\n # pre-release level (e.g. 0.0.1 to 0.0.2,\n
22
- \ # 1.0.0.pre1 to 1.0.0.pre2, 1.0.0.rc1 to\n #
23
- 1.0.0.rc2)\n$ gem bump --version 1.1.1 # Bump the gem version to the given
24
- version\n # number\n$ gem bump --version major #
25
- Bump the gem version to the next major\n # level
26
- (e.g. 0.0.1 to 1.0.0)\n$ gem bump --version minor # Bump the gem version to
27
- the next minor\n # level (e.g. 0.0.1 to 0.1.0)\n$
28
- gem bump --version patch # Bump the gem version to the next patch\n #
29
- level (e.g. 0.0.1 to 0.0.2)\n$ gem bump --version pre|rc|etc # Bump the gem version
30
- to the next\n # pre-release level (e.g. `pre`: 1.0.0.pre1\n
31
- \ # to 1.0.0.pre2, 0.0.1 to 0.0.2.pre1;\n #
32
- `beta`: 1.0.0.beta1 to 1.0.0.beta2, 0.0.1\n # to
33
- 0.0.2.beta1)\n$ gem bump --push # Bump and push to the origin git
34
- repository\n$ gem bump --tag # Bump and tag gem and pushes tags
35
- to the\n # origin repository\n$ gem bump --release
36
- \ # Bump and release gem\n$ gem bump --release --key KEY # Bump and
37
- release the gem, using the\n # specified API key
38
- from ~/.gem/credentials\n$ gem bump --release --host HOST # Bump and release the
39
- gem to a\n # gemcutter-compatible host other than\n
40
- \ # rubygems.org\n$ gem bump --release --quiet #
41
- Bump and release the gem, suppressing\n # output
42
- status messages\n$ gem bump --tag --release # Bump, tag, push and release
43
- gem\n$ gem bump --no-commit # Bump the gem version but don't git commit\n
44
- \ # (will be ignored if combined with push,\n #
45
- tag or release)"
data/sheets/help.yml DELETED
@@ -1,18 +0,0 @@
1
- ---
2
- help: |
3
- cheatly help
4
- ------------
5
- usage: $ cheatly list
6
- To list the available sheets
7
-
8
- $ cheatly show (sheetname)
9
- To see the sheet
10
-
11
- To create a new sheet local:
12
- 1. Clone the project: https://github.com/arthurnn/cheatly
13
- 2. $ cheatly create (sheetname)
14
- 3. Create a PR
15
-
16
- $ cheatly help
17
- To see this
18
- happy cheating !
@@ -1,63 +0,0 @@
1
- ---
2
- migrations: ! " Methods:\n create_table(name, options)\n drop_table(name)\n
3
- \ rename_table(old_name, new_name)\n add_column(table_name, column_name, type,
4
- options)\n rename_column(table_name, column_name, new_column_name)\n change_column(table_name,
5
- column_name, type, options)\n remove_column(table_name, column_name)\n add_index(table_name,
6
- column_name, index_type)\n remove_index(table_name, column_name)\n change_table(table_name)
7
- {|Table.new(table_name, self)| ...} \n \n Available Column Types (mappings are
8
- below):\n * integer\n * float\n * datetime\n * date\n * timestamp\n
9
- \ * time\n * text\n * string\n * binary\n * boolean\n * decimal
10
- :precision, :scale\n \n Valid Column Options:\n * limit\n * null (i.e. \":null
11
- => false\" implies NOT NULL)\n * default (to specify default values)\n * :decimal,
12
- :precision => 8, :scale => 3\n \n Rake Tasks:\n rake db:schema:dump: run after
13
- you create a model to capture the schema.rb\n rake db:schema:import: import the
14
- schema file into the current database (on\n error, check if your schema.rb has
15
- \":force => true\" on the create table\n statements\n ./script/generate migration
16
- MigrationName: generate a new migration with a\n new 'highest' version (run './script/generate
17
- migration' for this info at\n your fingertips)\n rake db:migrate: migrate
18
- your current database to the most recent version\n rake db:migrate VERSION=5:
19
- migrate your current database to a specific\n version (in this case, version
20
- 5)\n rake db:rollback: migrate down one migration\n rake db:rollback STEP=3:
21
- migrate down three migrations\n rake db:migrate RAILS_ENV=production: migrate
22
- your production database\n \n SQL:\n Queries can be executed directly:\n execute
23
- 'ALTER TABLE researchers ADD CONSTRAINT fk_researchers_departments\n FOREIGN
24
- KEY ( department_id ) REFERENCES departments( id )'\n \n Example Migration:\n
25
- \ class UpdateUsersAndCreateProducts < ActiveRecord::Migration\n def self.up\n
26
- \ rename_column \"users\", \"password\", \"hashed_password\" \n remove_column
27
- \"users\", \"email\" \n \n User.reset_column_information\n User.find(:all).each{|u|
28
- #do something with u}\n \n create_table \"products\", :force => true do
29
- |t|\n t.column \"name\", :text\n t.column \"description\", :text\n
30
- \ t.column \"price\", :decimal, :precision => 9, :scale => 2\n t.column
31
- \"category_id\", :integer\n end\n \n #the rails 2.0 way:\n create_table
32
- :people do |t|\n t.integer :account_id\n t.string :first_name,
33
- :last_name, :null => false\n t.text :description\n t.references
34
- :category # is the equivalent of t.integer :category_id\n t.timestamps\n
35
- \ end\n end\n \n def self.down\n rename_column \"users\",
36
- \"hashed_password\", \"password\" \n add_column \"users\", \"email\", :string\n
37
- \ drop_table \"products\" \n end\n end\n \n Find Highest version:\n
38
- \ script/runner \"puts ActiveRecord::Migrator.current_version\"\n \n Database
39
- Mapping\n \n Rails | db2 | mysql | openbase | Oracle
40
- \ |\n --- | --- | --- | --- | --- |\n
41
- \ :binary | blob(32678) | blob | object | blob |\n :boolean
42
- \ | decimal(1) | tinyint(1) | boolean | number(10) |\n :date |
43
- date | date | date | date |\n :datetime | timestamp
44
- \ | datetime | datetime | date |\n :decimal | decimal |
45
- decimal | decimal | decimal |\n :float | float | float
46
- \ | float | number |\n :integer | int | int(11)
47
- \ | integer | number(38) |\n :string | varchar(255) | varchar(255)
48
- | char(4096) | varchar2(255) |\n :text | clob(32768) | text | text
49
- \ | clob |\n :time | time | time | time |
50
- date |\n :timestamp | timestamp | datetime | timestamp | date
51
- \ |\n \n Rails | postgresql | sqlite | sqlserver | Sybase
52
- \ |\n --- | --- | --- | --- | --- |\n
53
- \ :binary | bytea | blob | image | image |\n :boolean
54
- \ | boolean | boolean | bit | bit |\n :date |
55
- date | date | datetime | datetime |\n :datetime | timestamp
56
- \ | datetime | datetime | datetime |\n :decimal | decimal |
57
- decimal | decimal | decimal |\n :float | float | float
58
- \ | float(8) | float(8) |\n :integer | integer | integer
59
- \ | int | int |\n :string | * | varchar(255)
60
- | varchar(255) | varchar(255) |\n :text | text | text | text
61
- \ | text |\n :time | time | datetime | datetime
62
- \ | time |\n :timestamp | timestamp | datetime | datetime |
63
- timestamp |"
data/sheets/sprintf.yml DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- sprintf: ! " %b => Binary integer\n %c => Single character\n %d => Decimal
3
- integer\n %e => Decimal integer displayed in exponential form (3e+07)\n %E
4
- \ => Decimal integer displayed in exponential form (3E+07)\n %f => Floating
5
- point number\n %g => Same as %e if exponent is less than -4, %f otherwise\n %G
6
- \ => Same as %E if exponent is less than -4, %f otherwise\n %o => Octal
7
- integer\n %s => String\n %u => Unsigned decimal integer\n %x => Hexadecimal
8
- integer (2a)\n %X => Hexadecimal integer uppercase (2A)\n %02d => 0 padded
9
- two digits\n %.02f => round to the hundredths\n %+ => +/- sign\n \n width
10
- & alignment\n \"%10s\" % \"hello\" => \" hello\" \n \"%-10s\" % \"hello\"
11
- => \"hello \""
@@ -1,20 +0,0 @@
1
- ---
2
- status_codes: ! " Use these codes for the #head or #render methods. ex:\n head
3
- :ok\n render :file => '404.html.erb', :status => :not_found\n \n 1xx Informational\n
4
- \ \n 100 => :continue\n 101 => :switching_protocols\n 102 => :processing\n \n
5
- \ 2xx Success\n \n 200 => :ok\n 201 => :created\n 202 => :accepted\n 203 =>
6
- :non_authoritative_information\n 204 => :no_content\n 205 => :reset_content\n
7
- \ 206 => :partial_content\n 207 => :multi_status\n 226 => :im_used\n \n 3xx
8
- Redirection\n \n 300 => :multiple_choices\n 301 => :moved_permanently\n 302
9
- => :found\n 303 => :see_other\n 304 => :not_modified\n 305 => :use_proxy\n 307
10
- => :temporary_redirect\n \n 4xx Client Error\n \n 400 => :bad_request\n 401
11
- => :unauthorized\n 402 => :payment_required\n 403 => :forbidden\n 404 => :not_found\n
12
- \ 405 => :method_not_allowed\n 406 => :not_acceptable\n 407 => :proxy_authentication_required\n
13
- \ 408 => :request_timeout\n 409 => :conflict\n 410 => :gone\n 411 => :length_required\n
14
- \ 412 => :precondition_failed\n 413 => :request_entity_too_large\n 414 => :request_uri_too_long\n
15
- \ 415 => :unsupported_media_type\n 416 => :requested_range_not_satisfiable\n 417
16
- => :expectation_failed\n 422 => :unprocessable_entity\n 423 => :locked\n 424
17
- => :failed_dependency\n 426 => :upgrade_required\n \n 5xx Server Error\n \n
18
- \ 500 => :internal_server_error\n 501 => :not_implemented\n 502 => :bad_gateway\n
19
- \ 503 => :service_unavailable\n 504 => :gateway_timeout\n 505 => :http_version_not_supported\n
20
- \ 507 => :insufficient_storage\n 510 => :not_extended"
data/sheets/strftime.yml DELETED
@@ -1,47 +0,0 @@
1
- ---
2
- strftime: ! "Ruby 1.8.7\r\n %a - The abbreviated weekday name (“Sun”)\r\n %A - The
3
- \ full weekday name (“Sunday”)\r\n %b - The abbreviated month name (“Jan”)\r\n
4
- \ %B - The full month name (“January”)\r\n %c - The preferred local date and
5
- time representation\r\n %d - Day of the month (01..31)\r\n %H - Hour of the day,
6
- 24-hour clock (00..23)\r\n %I - Hour of the day, 12-hour clock (01..12)\r\n %l
7
- - Hour of the day, 12-hour clock without leading zero (1..12)\r\n %j - Day of the
8
- year (001..366)\r\n %m - Month of the year (01..12)\r\n %M - Minute of the hour
9
- (00..59)\r\n %p - Meridian indicator (“AM” or “PM”)\r\n %S - Second of the minute
10
- (00..60)\r\n %U - Week number of the current year,\r\n starting with
11
- the first Sunday as the first\r\n day of the first week (00..53)\r\n %W
12
- - Week number of the current year,\r\n starting with the first Monday
13
- as the first\r\n day of the first week (00..53)\r\n %w - Day of the week
14
- (Sunday is 0, 0..6)\r\n %x - Preferred representation for the date alone, no time\r\n
15
- \ %X - Preferred representation for the time alone, no date\r\n %y - Year without
16
- a century (00..99)\r\n %Y - Year with century\r\n %Z - Time zone name\r\n %%
17
- - Literal “%” character\r\n\r\n t = Time.now\r\n t.strftime(\"Printed on %m/%d/%Y\")
18
- \ #=> \"Printed on 04/09/2003\"\r\n t.strftime(\"at %I:%M%p\") #=>
19
- \"at 08:56AM\"\r\n\r\nRuby 1.9\r\n %a - The abbreviated weekday name (“Sun”)\r\n
20
- \ %A - The full weekday name (“Sunday”)\r\n %b - The abbreviated month name
21
- (“Jan”)\r\n %B - The full month name (“January”)\r\n %c - The preferred local
22
- date and time representation\r\n %d - Day of the month (01..31)\r\n %e - Day of
23
- the month,\r\n a single digit is preceded by a space (range ' 1' to '31')\r\n
24
- \ %F - Equivalent to %Y-%m-%d (the ISO 8601 date format)\r\n %H - Hour of the day,
25
- 24-hour clock (00..23)\r\n %I - Hour of the day, 12-hour clock (01..12)\r\n %j
26
- - Day of the year (001..366)\r\n %L - Millisecond of the second (000..999)\r\n
27
- \ %m - Month of the year (01..12)\r\n %M - Minute of the hour (00..59)\r\n %N
28
- - Fractional seconds digits, default is 9 digits (nanosecond)\r\n %3N millisecond
29
- (3 digits)\r\n %6N microsecond (6 digits)\r\n %9N nanosecond
30
- (9 digits)\r\n %12N picosecond (12 digits)\r\n %p - Meridian indicator
31
- (“AM” or “PM”)\r\n %P - Meridian indicator (“am” or “pm”)\r\n %s - Number
32
- of seconds since 1970-01-01 00:00:00 UTC.\r\n %S - Second of the minute (00..60)\r\n
33
- \ %U - Week number of the current year,\r\n starting with the first Sunday
34
- as the first\r\n day of the first week (00..53)\r\n %W - Week number
35
- \ of the current year,\r\n starting with the first Monday as the first\r\n
36
- \ day of the first week (00..53)\r\n %w - Day of the week (Sunday is 0,
37
- 0..6)\r\n %x - Preferred representation for the date alone, no time\r\n %X - Preferred
38
- representation for the time alone, no date\r\n %y - Year without a century (00..99)\r\n
39
- \ %Y - Year with century\r\n %z - Time zone offset from UTC (+/-0000, e.g. EST
40
- = -0500)\r\n %Z - Time zone name\r\n %% - Literal “%” character\r\n\r\n t =
41
- Time.now #=> 2007-11-19 08:37:48 -0600\r\n t.strftime(\"Printed
42
- on %m/%d/%Y\") #=> \"Printed on 11/19/2007\"\r\n t.strftime(\"at %I:%M%p\")
43
- \ #=> \"at 08:37AM\"\r\n\r\nControlling leading padding in Ruby 1.9\r\n
44
- \ These codes work with any format code. %I is used as an example.\r\n %-I - remove
45
- any leading zeroes or spaces (“1”)\r\n %_I - force a leading space (and no leading
46
- zeroes) if necessary (“ 1”)\r\n %0I - force a leading zero (and no leading spaces)
47
- if necessary (“01”)"