Skip to content

Instantly share code, notes, and snippets.

View andy922200's full-sized avatar

Andy Lien andy922200

View GitHub Profile
@andy922200
andy922200 / App.vue
Last active March 23, 2021 08:17
Vue3 / Vue-Cli4 TypeScript i18N Demo
<template>
<el-select v-model="selectedLanguageModel" placeholder="Please Select">
<el-option
v-for="(item) in LayoutLanguages"
:key="item.param"
:label="item.title"
:value="item.param"
>
</el-option>
</el-select>
@andy922200
andy922200 / Example-9.js
Last active March 26, 2019 18:53
[JS101] 用 JavaScript 一步步打造程式基礎 - 練習題(三)
//計算質數數量,並印出所有結果
function isPrime(n){
if(n===1) return false
for(var i=2; i<=Math.sqrt(n); i++){
if(n%i===0){
return false
}
}
return true
}
@andy922200
andy922200 / Example-8.js
Last active March 25, 2019 22:14
[JS101] 用 JavaScript 一步步打造程式基礎 - 練習題(二)
//印出多個星星(巢狀迴圈), console.log
function stars(n){
for(var i=1; i<=n; i++){
var result = ''
for(var j = 1; j<=i; j++){
result += '*'
}console.log(result)
}
}
@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){
@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-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-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-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-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
/*Contact Form 7 表格  RWD */
.wpcf7-form input[type="text"], input[type="email"], input[type="tel"]
{
width:100% !important;
}