Skip to content

Instantly share code, notes, and snippets.

@vibinnair
vibinnair / bundle-install-error.txt
Created September 11, 2012 10:22
bundle install error - sign-in-with-twitter
/home/test/Vibin/Workarea/Research/github/sign-in-with-twitter/Gemfile:2:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x000000008eea90> (NoMethodError)
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/dsl.rb:7:in `instance_eval'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/dsl.rb:7:in `evaluate'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/definition.rb:18:in `build'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:135:in `definition'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/cli.rb:220:in `install'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor/task.rb:22:in `run'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
/home/test/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor.rb:263:in `dispatch'
/home/test/.rvm/gems/
@vibinnair
vibinnair / bundle-error-capybara
Created December 18, 2012 14:34
bundle install error - survey-web
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/vibin/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Gem files will remain installed in /home/vibin/Research/github/survey-web/vendor/bundle/ruby/1.9.1/gems/capybara-webkit-0.12.1 for inspection.
Results logged to /home/vibin/Research/github/survey-web/vendor/bundle/ruby/1.9.1/capybara-webkit-0.12.1/./gem_make.out
An error occured while installing capybara-webkit (0.12.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '0.12.1'` succeeds before bundling
@vibinnair
vibinnair / bundle-error-mysql
Created December 19, 2012 14:30
bundle install error while configuring survey-web for mysql database.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/vibin/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
@vibinnair
vibinnair / migration error for mysql db
Created December 19, 2012 14:34
migration fails for AddColumnPublishedToSurveys migration file in survey-web application.
== AddColumnPublishedToSurveys: migrating ====================================
-- add_column(:surveys, :published, :boolean, {:default=>:false})
rake aborted!
An error has occurred, all later migrations canceled:
Mysql2::Error: Invalid default value for 'published': ALTER TABLE `surveys` ADD `published` tinyint(1) DEFAULT 'false'
/home/volition/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `query'
/home/volition/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `block in execute'
/home/volition/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/volition/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
@vibinnair
vibinnair / bundle-error-rmagic
Last active December 10, 2015 21:08
bundle-error whle installing rmagic gem
Installing rmagick (2.12.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/vibin/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:107: Use RbConfig instead of obsolete and deprecated Config.
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.12.2. Can't find Magick-config in /home/vibin/.rvm/gems/ruby-1.9.3-p194/bin:/home/vibin/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/vibin/.rvm/rubies/ruby-1.9.3-p194/bin:/home/vibin/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
import Foundation
func sumOfElements(_ array: [Int], _ sum: Int) -> Int {
if array.count <= 0 {
return sum
}
let newArray = Array(array.dropFirst(1))
return sumOfElements(newArray, sum + array.first!)
}
import Foundation
func add(_ x: Int, _ y: Int) -> Int {
return x + y
}
func square(_ x: Int) -> Int {
return x * x
}
https://www.hackerrank.com/challenges/fp-hello-world-n-times/problem
import Foundation
func helloWorld(_ numberOfTimes: Int) {
if numberOfTimes <= 0 {
return
}
print("Hello World")
https://www.hackerrank.com/challenges/fp-list-replication/problem
import Foundation
func printElements(_ numberOfTimes: Int, _ list: [Int]) -> [Int] {
if list.count <= 0 {
return list
}