Skip to content

Instantly share code, notes, and snippets.

View andy922200's full-sized avatar

Andy Lien andy922200

View GitHub Profile
@andy922200
andy922200 / fb-chat-records-download.js
Last active January 20, 2019 01:59
Facebook Chat Records Download
var id =
setInterval(function () { document.getElementById('see_older')
.getElementsByClassName('content')[0].click(); }, 500);
@andy922200
andy922200 / Example-1.css
Last active January 30, 2019 21:56
ALPHA CAMP Semester 1 Week 2
*{
box-sizing:border-box; /* 全版面使用,讓排版較為直覺。*/
}
.clearfix{
clear:both;
}
#banner{
background-image:url("http://picsum.photos/1170/450?image=950");
/*Original format*/
if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
preg_match_all( '/./u', $text, $words_array );
$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
$sep = '';
} else {
$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
$sep = ' ';
/*Contact Form 7 表格  RWD */
.wpcf7-form input[type="text"], input[type="email"], input[type="tel"]
{
width:100% !important;
}
@andy922200
andy922200 / Example-2.rb
Last active January 31, 2019 02:28
ALPHA CAMP SEMESTER 1 Week 4
#使用者輸入正確性測試
puts "Please enter an integer (>=0)."
number = gets.chomp
#測試使用者的輸入是否為正整數 or 0 (此時為字串)
while number.match (/\D/)
puts "Please enter a correct integer again."
number = gets.chomp
end
@andy922200
andy922200 / Example-3.rb
Created January 31, 2019 04:33
Alpha Camp Semester 1 Week 3
#以下為 Array 應用
#使用者輸入
puts "Hi, please enter a sentence."
sentence = gets.chomp
#分拆句子結構 (拆字串&序號)
sentence_split = sentence.split(" ")
sentence_index = (0..sentence_split.length-1).to_a
#取得每項字母長度
@andy922200
andy922200 / Example-4.rb
Last active March 6, 2019 15:29
Learn Ruby on Rails - Codecademy
# .reverse 的用法,倒轉字串
a = "simultaneously"
puts a.reverse
# .upcase & .downcase,轉換大小寫
a = "simultaneously"
puts a.upcase
puts a.downcase
# =begin & =end 搭配,將一個範圍裡的 Code 都不被解讀。
@andy922200
andy922200 / Example-5.js
Last active March 15, 2019 18:35
[JS101] 用 JavaScript 一步步打造程式基礎 - 判斷式
/if,else if,else 判斷式/
var score = 40
if (score >= 70){
console.log('Perfect!')
}else if (score >= 60){
console.log('Good!')
}else if (score >= 50){
console.log('OK!')
}else{
console.log('See u next time!')
@andy922200
andy922200 / Example-6.js
Last active March 16, 2019 17:52
[JS101] 用 JavaScript 一步步打造程式基礎 - 迴圈&函式
/*debugger 除錯用& do/while */
var i = 1
debugger
do {
console.log(i++)
}while(i <= 100)
console.log("Finished!")
/*for loop 範例*/
@andy922200
andy922200 / Example-7.js
Last active March 19, 2019 17:03
[JS101] 用 JavaScript 一步步打造程式基礎 - 練習題(一)
/*判斷第一位是否為大寫字母*/
function isUpperCase(str){
var key = str[0]
return key >= "A" && key <= "Z"
}
console.log(isUpperCase("Abcd"))
/*判斷第一個大寫字母的位置,並回傳其位置*/
function position(str){