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
query($filter: JSON) { | |
family_history(filter: $filter){ | |
submitter_id | |
auth_resource_path | |
family_history_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
func (s ResultObject) UnmarshalJSON(data []byte) map[string]interface{} { | |
var z map[string]interface{} | |
if err := json.Unmarshal(data, &z); err != nil { | |
fmt.Println(string(data[:])) | |
panic(err) | |
} | |
return z | |
} |
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
project_id: $PROJECT_ID #open project settings and go to API section | |
api_token: $API_TOKEN #open profile settings and go to API & SSO > New Token > create Token | |
base_path: "./" | |
base_url: "https://api.crowdin.com" | |
preserve_hierarchy: true | |
files: | |
- | |
source: '/website/docs/**/*.md' #source files filter | |
translation: '/website/translated_docs/%locale%/**/%original_file_name%' #where translations are stored |
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
scanner := bufio.NewScanner(file) | |
const maxCapacity = 512*1024 | |
buf := make([]byte, maxCapacity) | |
scanner.Buffer(buf, maxCapacity) | |
// The bufio.ScanLines is used as an | |
// input to the method bufio.Scanner.Split() | |
// and then the scanning forwards to each | |
// new line using the bufio.Scanner.Scan() |
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
let path = Path::new("resources/graphql_queries_popular.txt"); | |
let path_new_file = Path::new("resources/graphql_generated_queries.txt"); | |
let file = File::create(path_new_file).unwrap(); | |
let mut file = LineWriter::new(file); | |
let mut reader = my_reader::BufReader::open(&path).unwrap(); | |
let mut buffer = String::new(); | |
while let Some(line) = reader.read_line(&mut buffer) { | |
use regex::{Regex,Captures}; |
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 max(xs: List[Int]): Int = { | |
if (xs.isEmpty) | |
throw new NoSuchElementException | |
else if (xs.length == 1) | |
xs.head | |
else | |
if (xs.head > max(xs.tail)) xs.head else max(xs.tail) | |
} | |
} |
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 sum(xs: List[Int]): Int = { | |
if( xs.isEmpty) | |
0 | |
else | |
xs.head + sum(xs.tail) | |
} |
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
@RunWith(SpringRunner.class) | |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, | |
properties = "blog-service.base-url:http://localhost:8082", | |
classes = BlogServiceClient.class) | |
@ContextConfiguration | |
public class UnitTest { | |
@Autowired | |
private BlogServiceClient blogServiceClient; |
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
@Component | |
public class BlogServiceClient { | |
private final RestTemplate restTemplate; | |
public BlogServiceClient(@Value("${blog-service.base-url}") String baseUrl) { | |
this.restTemplate = new RestTemplateBuilder().rootUri(baseUrl).build(); | |
} | |
public Blog getBlog(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
def jaccard_similarity(a, b): | |
a = set(a) | |
b = set(b) | |
intersection = len(a.intersection(b)) | |
union = len(a.union(b)) | |
return intersection / union |