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
| Sub WorksheetLoop() | |
| Dim I As Integer | |
| Dim worksheetName As String | |
| Dim sheet As Worksheet | |
| I = 1 | |
| For Each sheet In ActiveWorkbook.Worksheets | |
| worksheetName = "" & I & " - " & sheet.Name | |
| sheet.Name = worksheetName |
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
| $elements = $('div.tutorial-index'); | |
| heights = $elements.map(function(i, ele){ return $(ele).height(); }); | |
| max = 0 | |
| $.each(heights, function(i, height){ if(height > max) max = height;}); | |
| $elements.height(max); |
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 Car | |
| def initialize(instruments) | |
| @instruments = instruments | |
| end | |
| def mileage | |
| @_mileage ||= @instruments.select(:odometer).calculate_value | |
| 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 'savon' | |
| client = Savon.client('https://dev.tch.com/richapp/Wsdl.action?wsdl=/axis2/services/CardManagementWS') | |
| client.http.auth.ssl.verify_mode = :none | |
| client.wsdl.soap_actions |
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
| self.class.find_by_sql(["SELECT users.* FROM users | |
| INNER JOIN connections AS second_degree_connections | |
| ON second_degree_connections.target_id = users.id | |
| INNER JOIN connections AS first_degree_connections | |
| ON first_degree_connections.target_id = second_degree_connections.owner_id | |
| WHERE first_degree_connections.owner_id = ?", self.id]) |
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
| # This file should contain all the record creation needed to seed the database with its default values. | |
| # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | |
| # | |
| # Examples: | |
| # | |
| # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | |
| # Mayor.create(name: 'Emanuel', city: cities.first) | |
| Interview.delete_all | |
| User.delete_all |
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
| ans = 0 | |
| for i in 100..999 | |
| for j in (100..999).to_a.reverse | |
| x = i*j | |
| if x == (x).to_s.reverse.to_i | |
| ans = x | |
| break | |
| elsif x < ans | |
| break | |
| 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 'mathn' | |
| n = 600851475143 | |
| Prime.each do |x| | |
| while n % x == 0 | |
| n = n/x | |
| end | |
| break if x > n/2 | |
| end | |
| puts n |