create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| require 'find' | |
| def format_mb(size) | |
| conv = [ 'b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb' ]; | |
| scale = 1024; | |
| ndx = 1 | |
| if( size < 2*(scale**ndx) ) | |
| return "#{(size)} #{conv[ndx-1]}" | |
| end |
| class Seat | |
| attr_accessor :person | |
| def initialize(position) | |
| @position = position | |
| @person = nil | |
| end | |
| end | |
| class AirPlane | |
| attr_reader :seating_matrix |
| class Array | |
| def my_map | |
| return to_enum :my_map unless block_given? | |
| inject([]) { |result, value| result << yield(value) } | |
| end | |
| end | |
| a = [1, 2, 3, 4] | |
| b = a.my_map do |x| | |
| x + 1 |
| class Array | |
| def my_map | |
| result = [] | |
| return to_enum :my_map unless block_given? | |
| each { |s| result << yield(s) } | |
| result | |
| end | |
| end | |
| a = [1, 2, 3, 4] |
| D, [2016-07-26T20:14:20.297579 #48336] DEBUG -- : SOLR Request (7.3ms) [ path=select parameters={fq: ["type:Artist", "({!join from=artist_id_i to=id_i}show_name_s:Sample OR {!join from=artist_id_i to=id_i}show_time_d:[* TO 2016-05-20T21:00:00Z])"], start: 0, rows: 30, q: "*:*"} ] | |
| RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request | |
| Error: 'org.apache.solr.search.SyntaxError: Cannot parse \'show_time_d:[*\': Encountered "<EOF>" at line 1, column 14. | |
| URI: http://localhost:8982/solr/development/select?wt=ruby | |
| Request Headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"} | |
| Request Data: "fq=type%3AArtist&fq=%28%7B%21join+from%3Dartist_id_i+to%3Did_i%7Dshow_name_s%3ASample+OR+%7B%21join+from%3Dartist_id_i+to%3Did_i%7Dshow_time_d%3A%5B*+TO+2016%5C-05%5C-20T21%5C%3A00%5C%3A00Z%5D%29&start=0&rows=30&q=*%3A*" | |
| Backtrace: /Users/sagarb/.rvm/gems/ruby-2.2.2@magnifi_gt/gems/rsolr-1.1.1/lib/rsolr/client.rb:288:in `adapt_response' | |
| /Users/sagarb/.rvm/gems/ruby-2.2.2@magnifi_gt/gems/rsolr-1.1.1/ |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # @kyletcarlson | |
| # | |
| # This skeleton also assumes you're using the following gems: |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| # Usage of class_eval method | |
| class Sample | |
| end | |
| s = Sample.new | |
| Sample.class_eval do | |
| def say_hello |
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: nginx | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: starts the nginx web server | |
| # Description: starts nginx using start-stop-daemon |