This file contains hidden or 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
| { | |
| "days": [ | |
| { | |
| "date": "20130806", | |
| "sleepPeriods": [ | |
| { | |
| "state": "LYING", | |
| "duration": 7, | |
| "minuteIndex": 317 | |
| }, |
This file contains hidden or 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
| def get_coordinates | |
| if @branch.present? | |
| @show_cities = Purchase.where(:branch = @branch) | |
| @show_sale_points = Purchase.find(:all, :select => "DISTINCT sale_point") | |
| @show_all_blanches = Purchase.find(:all, :select => "DISTINCT branch") | |
| @show_sale_points = Purchase.where(:city => @city, :branch => @branch) if @city.present? | |
| if @city.present? && @sales_point.present? | |
| coordinates = Purchase.where(:city => @city, :branch => @branch, :sale_point => @sale_point) | |
| @latitude = coordinates.first.latitude | |
| @longitude = coordinates.first.longitude |
This file contains hidden or 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
| describe Class do | |
| before do | |
| @kopejais = 1 | |
| end | |
| context "Konteksts 1" do | |
| before do | |
| @konteksta_1_variablis = 2 | |
| end | |
| it "should be 3" do |
This file contains hidden or 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
| MyModel.class_eval do | |
| def to_param | |
| id | |
| end | |
| end |
This file contains hidden or 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 "pry" | |
| require "grit" | |
| COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
| def days_in_month(month, year = Time.now.year) | |
| return 29 if month == 2 && Date.gregorian_leap?(year) | |
| COMMON_YEAR_DAYS_IN_MONTH[month] | |
| end |
This file contains hidden or 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
| #encoding: utf-8 | |
| definēt a | |
| ja patiesi | |
| drukāt "a" | |
| citādi | |
| drukāt "b" | |
| beigas | |
| priekš i iekš [1,2,3] | |
| drukāt i | |
| beigas |
This file contains hidden or 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 Time | |
| def self.nowish | |
| time = self.now | |
| minute = time.min > 30 ? 30 : 00 | |
| "#{time.hour.to_s}:#{minute.to_s} ish" | |
| end | |
| end |
This file contains hidden or 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
| def lat=(lat) | |
| @lat = lat | |
| end |
This file contains hidden or 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 'spec_helper' | |
| describe Terminal do | |
| let(:terminal) { | |
| Terminal.create( | |
| :address => "Kuldiga, Grants iela 29, Latvija", | |
| :type => "ATM" | |
| ) | |
| } |
This file contains hidden or 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
| irb(main):011:0> def 新增三個(數) | |
| irb(main):012:1> 數+3 | |
| irb(main):013:1> end | |
| => nil | |
| irb(main):014:0> 新增三個(3) | |
| => 6 |