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 a = 1 | |
let b = 1 | |
let count = 0 | |
while (a <= 20) { | |
while (b <= 20) { | |
if (((a * 2 + b) <= 20) && a * 2 > b && a !== b) { | |
console.log(`發現等邊三角形 | 三邊長分別為: ${a}、${a}、${b}`) | |
count++ | |
} |
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
function isInValidTriangle (a, b, c) { | |
const result = !((a+b)>c) || !((b+c)>a) || !((c+a)>b) || | |
!((a-b)<c) || !((b-a)<c) || !((b-c)<a) || !((c-b)<a) ||!((c-a)<b) || | |
!((a-c)<b) || !(a>0) || !(b>0) || !(c>0) | |
return result | |
} | |
if (isInValidTriangle(a, b, c)) { | |
console.log ('invalid') | |
} else if (a===b && b===c) { |
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
if (isValidTriangle(a, b, c)) { | |
if (a === b && b === c) { | |
console.log("是等邊三角形!") | |
} else if (a === b || b === c || a === c) { | |
console.log("是等腰三角形!") | |
} else { | |
console.log("是不等邊三角形!") | |
} | |
} else { | |
console.log("Invalid! (無法組成有效三角形) ") |
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
var flags = [ | |
{ | |
"code": "Afghanistan", | |
"name": "Afghanistan", | |
"img": "https://lipis.github.io/flag-icon-css/flags/4x3/af.svg" | |
}, | |
{ | |
"code": "Aland Islands", | |
"name": "Aland Islands", | |
"img": "https://lipis.github.io/flag-icon-css/flags/4x3/ax.svg" |
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
// Reference: | |
// https://github.com/Rob--W/cors-anywhere | |
// Listen on a specific host via the HOST environment variable | |
var host = process.env.HOST || '0.0.0.0'; | |
// Listen on a specific port via the PORT environment variable | |
var port = process.env.PORT || 8081; | |
var cors_proxy = require('cors-anywhere'); | |
cors_proxy.createServer({ |
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 imageLinks = [] | |
const async = require('async') | |
let fs = require('fs') | |
let request = require('request') | |
let path = require('path') | |
const downloadImage = (src, dest, callback) => { | |
request.head(src, (err, res, body) => { | |
if (err) { console.log(err); return } |
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
<template> | |
<div class="zoomer" ref="zoomer" @mousemove="moveBG" @mouseout="mouseOut"> | |
<div class="img normal v-fade" | |
v-show="!hoverNow" | |
:style="{ | |
backgroundImage: `url(${imgNormal})` | |
}" | |
></div> | |
<div | |
v-show="hoverNow" |
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
Open command prompt (Terminal) and run: | |
ffmpeg -i "filename.flv" -vcodec copy -acodec copy "filename.mp4" | |
This will copy video track and audio track from filename.flv to filename.mp4. The operation is lossless (there is no quality loss). |
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
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
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
html { | |
background: url(image url) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
height: 100%; | |
overflow: hidden; | |
} |
NewerOlder