Skip to content

Instantly share code, notes, and snippets.

View lalithr95's full-sized avatar
🎯
Focusing

Lalith Rallabhandi lalithr95

🎯
Focusing
View GitHub Profile
@lalithr95
lalithr95 / integer.rb
Created October 7, 2017 03:31 — forked from pithyless/integer.rb
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
== DrupalSchema: migrating ===================================================
-- table_exists?("comments")
-> 0.0003s
-- create_table("comments", {:primary_key=>"cid", :options=>"ENGINE=MyISAM"})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "comments" ("cid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "pid" integer DEFAULT 0 NOT NULL, "nid" integer DEFAULT 0 NOT NULL, "uid" integer DEFAULT 0 NOT NULL, "subject" varchar(64) DEFAULT '' NOT NULL, "comment" text(2147483647) NOT NULL, "hostname" varchar(128) DEFAULT '' NOT NULL, "timestamp" integer DEFAULT 0 NOT NULL, "status" integer(1) DEFAULT 0 NOT NULL, "format" integer(2) DEFAULT 0 NOT NULL, "thread" varchar(255) NOT NULL, "name" varchar(60), "mail" varchar(64), "homepage" varchar(255)) ENGINE=MyISAM
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/sqlite3
Lalith at Laliths-MacBook-Pro in ~/plots2 on master
$ rake test
/Users/Lalith/plots2/config/boot.rb:6: warning: File.exists? is a deprecated name, use File.exist? instead
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/activesupport-3.2.22.2/lib/active_support/core_ext/load_error.rb:9: warning: method redefined; discarding old path
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/sass-rails-3.2.6/lib/sass/rails/railtie.rb:36: warning: possibly useless use of :: in void context
/Users/Lalith/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/therubyracer-0.12.2/v8/init.bundle: warning: method redefined; discarding old IntegerValue
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/therubyracer-0.12.2/lib/v8/error.rb:43: warning: assigned but unused variable - trace_framework
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/therubyracer-0.12.2/lib/v8/error.rb:69: warning: `*' interpreted as argument prefix
/Users/Lalith/.rvm/gems/ruby-2.1.2/gems/therubyracer-0.12.2/lib/v8/error.rb:74: warning: `*' interpreted as argument prefix
$ git log
commit 8ba89bd46bf88c6af5c54844b3a45f6aa12dfed6
Author: Lalith <lalithr95@gmail.com>
Date: Fri Mar 4 21:33:28 2016 +0530
Fix error handling issues
commit 73c6764bf3520c9ae9033b80d09c35d5dbb02c8e
Merge: c2dda7d 0b33397
Author: Jeffrey Warren <jeff@unterbahn.com>
$ rake test
Run options:
# Running tests:
Finished tests in 0.177350s, 33.8314 tests/s, 56.3857 assertions/s.
6 tests, 10 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
Run options:
Test1234
hello123