Skip to content

Instantly share code, notes, and snippets.

View Yukaii's full-sized avatar
👾
nyan, nyan, nyan

Yukai Huang Yukaii

👾
nyan, nyan, nyan
View GitHub Profile
@Yukaii
Yukaii / 2.cpp
Created June 4, 2014 12:12
Primitive Root
/**
* 密碼學導論作業二/第二題
* @author Yukai Huang
* NTUST 2014
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdio.h>
@Yukaii
Yukaii / directory_traversal.rb
Last active August 29, 2015 14:09
a simple snippets for traversing all sub directories
# usage:
#
# dir_traversal do
# the_code_want_to_run_in_each_directory
# end
def self.dir_traversal
Dir.glob("*").each do |name|
if File.directory?(name)
Dir.chdir(name)
[
{
"course_title": "控制系統分析與設計",
"course_code": "AC5009701",
"lecturer": "楊振雄",
"credits": "3",
"required_or_elective": "選",
"full_or_half_semester": "半",
"semester": "1032",
"course_limitations": null,
@Yukaii
Yukaii / opentech.json
Created December 25, 2014 07:00
webscraper.io sitemap for opentech全華網路書店。不過挺多頁的,用來爬連結就好了。
{
"startUrl": "http://www.opentech.com.tw/search/result.asp",
"selectors": [{
"parentSelectors": ["_root", "nextpage"],
"type": "SelectorLink",
"multiple": true,
"id": "nextpage",
"selector": "p a:nth-of-type(2)",
"delay": ""
}, {
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

程式語言 Prolog 作業

##環境建制

  brew install gnu-prolog # 安裝 gnu prolog
  gprolog # 跑起來
  consult('pa3prolog.pl'). # 載入檔案
  # ...玩 
@Yukaii
Yukaii / index.html
Created April 17, 2015 06:27
Google Chinese Webfont
<!DOCTYPE html>
<html>
<head>
<title>一點 Google 中文字體的淺嚐即止</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<h1 class="song">結我的來達相能維多</h1>
<p class="hei">
@Yukaii
Yukaii / random_array.rb
Created April 17, 2015 07:04
隨機順序 array,ruby 真好
data = Array.new(1000) { |e| e+1 }
data.shuffle!
@Yukaii
Yukaii / wootalk.js
Last active January 2, 2016 13:46
沒有 uglifier 所以就直接複製出來啦
function scrollBottomDistance() {
return $("#contents").height() - ($("#main").scrollTop() + $("#main").height())
}
function scrollToBottomDistance(e) {
return e.children().height() - (e.scrollTop() + e.height())
}
function scrollToBottom(e) {
value = e.children().height() - e.height() - 1, setTimeout(function() {
臺北市 http://vote2016.cec.gov.tw/zh_TW/P1/n100000000000000.html
北投區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000100000000.html
士林區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000200000000.html
大同區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000300000000.html
中山區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000400000000.html
松山區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000500000000.html
內湖區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000600000000.html
南港區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000700000000.html
萬華區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000800000000.html
中正區 http://vote2016.cec.gov.tw/zh_TW/P1/n100000900000000.html