Skip to content

Instantly share code, notes, and snippets.

View Daviswww's full-sized avatar
🤩
keep going!

HSING-WEI HO Daviswww

🤩
keep going!
View GitHub Profile
require 'yaml'
yml_string = ''
yml_datas = YAML.safe_load(File.read(ARGV[0]))
yml_datas[0].each do |key|
yml_string += key[0] == 'date' ? key[0].to_s : "\t#{key[0]}"
end
yml_string += "\n"
yml_datas.each do |datas|
data = ''
require 'yaml'
TSV_DATA = File.read(ARGV[0]).split("\n")
title = TSV_DATA[0].split(/\t/)
hash_data = []
TSV_DATA.drop(1).each do |datas|
h = {}
data = datas.split(/\t/)
(0..title.length - 1).each { |i| h[title[i]] = data[i] }
def fizzbuzz(size)
ary = []
1.upto size do |temp|
ary << fizz_or_buzz_or_fizzbuzz(temp)
end
ary.collect! { |a| yield(a) } if block_given?
ary
end
def fizz_or_buzz_or_fizzbuzz(temp)
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
using namespace std;
const int N = 100;
#include<iostream>
#include<vector>
using namespace std;
const int N = 30;
struct Node
{
int pr;
int left;
int right;
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
const int N = 100;
struct Node {
int parent;
int left;
int right;
//output
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int N = 100005;
struct Node
{
string type;
int parent;
#include<iostream>
#define swap(x, y) {Node z = x; x = y; y = z;}
using namespace std;
const int N = 100005;
struct Node {
char suit;
int number;
int index;
};
#include<iostream>
#define swap(x, y) {int z = x; x = y; y = z;}
using namespace std;
const int N = 100005;
int Partition(int *a, int p, int r){
int x = a[r];
int i = p-1;
for(int j = p; j < r; j++){
if(a[j] <= x){
i++;