This file contains 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
package com.example.demo; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
public class BookController { |
This file contains 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
package com.example.demo; | |
import lombok.Getter; | |
import lombok.Setter; | |
public class Book { | |
@Getter | |
@Setter | |
private String id; |
This file contains 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
package common; | |
import java.util.Random; | |
public class MyRandom { | |
private String alphabets = "abcdefghijklmnopqrstuvwxyz"; | |
private String numbers = "0123456789"; | |
private String alphanumerics = numbers + alphabets; | |
public String randomizer(String validChars, int length){ |
This file contains 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 random(n) | |
s = '' | |
for i in 0..n-1 | |
s += rand(0..9).to_s | |
end | |
return s | |
end | |
def get_digit(s, i) | |
output = 0 |
This file contains 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 'colorize' | |
puts 'black'.black | |
puts 'light_black'.light_black | |
puts 'red'.red | |
puts 'light_red'.light_red | |
puts 'green'.green | |
puts 'light_green'.light_green | |
puts 'yellow'.yellow | |
puts 'light_yellow'.light_yellow |
This file contains 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
package main | |
import( | |
"fmt" | |
"reflect" | |
) | |
type Cat struct{} | |
func (c Cat) Say() string{return "meow"} |
This file contains 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
package main | |
import ( | |
"fmt" | |
) | |
type Cat struct{} | |
func (c Cat) Say() string { return "meow" } | |
type Dog struct{} |
This file contains 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 monty(switch_choice) | |
doors = ['1','2','3'] #can be renamed to A,B,C | |
prize = doors[rand(doors.length)] | |
choose1 = doors[rand(doors.length)] | |
open = prize #to force it into while loop | |
while open==prize or open==choose1 | |
open = doors[rand(doors.length)] | |
end | |
puts 'prize = door %s' % prize | |
puts 'choose1 = door %s' % choose1 |
This file contains 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
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script> | |
</head> | |
<body> | |
<table border="1"> | |
<thead> | |
<tr> | |
<th>Fruit</th> | |
<th>Quantity</th> |
This file contains 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 'mysql2' | |
def my_db | |
return Mysql2::Client.new( | |
:host => '127.0.0.1', | |
:username => 'root', | |
:password => 'password', | |
:encoding => 'utf8mb4', | |
:database => 'medium_story', | |
:ssl_mode => 'disabled', |