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
| import java.util.HashMap; | |
| public class CodeRunner { | |
| Student student = new Student(); | |
| String answer_format = "Test1: %s\nTest2: %s"; | |
| static String default_output_template = "Correct answers:\nTest1=%s\nTest2=%s\n"; | |
| public static void main(String[] args) { | |
| CodeRunner code = new CodeRunner(); | |
| HashMap answers = code.tests(); |
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
| view | |
| <td><%= link_to "Delete", { controller: 'users', action: 'delete', id: user.id }, { confirm: 'Are you sure?', method: :delete } %></td> | |
| controller | |
| User.find(params[:id]).destroy | |
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 'rspec' | |
| require './tuple' | |
| # f(“()”) -> true | |
| # f(“(1,2,988)”) -> true | |
| # f(“(1,23,(4,5),076)”) -> true | |
| describe 'tuple' do | |
| it "can be empty" do | |
| expect(TupleValidation.is_tuple?("()")).to eq(true) |
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
| # * question 2. nt (num tuple) | |
| # Here is the definition of the number tuple. Please write a function to decide whether a string is a valid num tuple representation. | |
| # item -> () or [0-9]+ or nt | |
| # nt -> (item,item,item+) | |
| # f(“()”) -> true | |
| # f(“(1,2,988)”) -> true | |
| # f(“(1,23,(4,5),076)”) -> true |
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 'rspec' | |
| require './transaction_fee_calculation' | |
| describe 'calculation' do | |
| it "tax should be 0.1 for 5 Bitcoins" do | |
| expect(FeeCalculator.for(5)).to eq(0.1) | |
| end | |
| it "tax should be 0.2 for 10 Bitcoins" do | |
| expect(FeeCalculator.for(10)).to eq(0.2) |
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
| # 1. Transaction Fee Caculation | |
| # We have a ladder fee structure. Please write a function to calculate total transaction fee we can get given the trading volume. | |
| # Volume Fee | |
| # 0 - 10 btc 2% | |
| # 10 - 50 btc 1% | |
| # 50 - 100 btc 0.5% | |
| # 100 - 1000 btc 0.25% | |
| # 1000 - 5000 btc 0.1% |
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 remove_tuples_from(string) | |
| string.gsub! ' ', '' | |
| string.gsub! /\(\)|[\,]?\([\d]*((\d\,)*\d)*\)|\(\)|\([\d]*((\d\,)*\d)*\)[\,]+|\(\)|\([\d]*((\d\,)*\d)*\)/x, '' | |
| 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 'nokogiri' | |
| class String | |
| def underscore | |
| self.gsub(/::/, '/'). | |
| gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). | |
| gsub(/([a-z\d])([A-Z])/,'\1_\2'). | |
| tr("-", "_"). | |
| downcase | |
| 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
| { | |
| "nodes":[ | |
| { | |
| "id":12105, | |
| "name":"ALICANTE04:PING", | |
| "type":"IC", | |
| "level":"" | |
| }, | |
| { | |
| "id":12115, |
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
| org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://gcm-http.googleapis.com/gcm/send":Connection timed out; nested exception is java.net.ConnectException: Connection timed out | |
| at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:580) | |
| at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530) | |
| at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:330) | |
| at com.unicred.message.MessageService.sendMessage(MessageService.java:37) | |
| at com.unicred.router.MessageRouter.sendToUser(MessageRouter.java:90) | |
| at com.unicred.router.MessageRouter.route(MessageRouter.java:48) | |
| at com.unicred.receiver.Receiver.receiveMessage(Receiver.java:27) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
OlderNewer