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
package repository_test | |
import ( | |
"database/sql" | |
"fmt" | |
"github.com/testcontainers/testcontainers-go" | |
"github.com/testcontainers/testcontainers-go/wait" | |
"golang.org/x/net/context" | |
"gorm.io/gorm/logger" | |
"log" |
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
/** | |
* Definition for singly-linked list. | |
* type ListNode struct { | |
* Val int | |
* Next *ListNode | |
* } | |
*/ | |
func removeNthFromEnd(head *ListNode, n int) *ListNode { | |
count_from_last := 0 | |
return removeHelper(head, n, &count_from_last) |
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 solution(votes) { | |
function findPairs(votes, arr = [0,0], curr = 0 ) { | |
let next_idx = curr+1 | |
if (!votes[next_idx]) { | |
return [ | |
[arr[0] + votes[curr], arr[1]], | |
[arr[0] , arr[1] + votes[curr]] |
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
const browser: Browser = await puppeteer.launch() | |
const page: Page = await browser.newPage() | |
await page.setViewport({ width: 1440, height: 900 }) | |
await page.goto(url, { waitUntil: ['networkidle2'], timeout: 0 }) | |
const screenshot = await page.screenshot({ encoding: 'base64'}) | |
await browser.close() | |
const src = `data:image/jpeg;base64,${screenshot}` | |
res(new responseData(src, { name: 'screenshot' })) |
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
const browser: Browser = await puppeteer.launch() | |
const page: Page = await browser.newPage() | |
await page.setViewport({ width: 1440, height: 900 }) | |
await page.goto(url) | |
const screenshot = await page.screenshot({ encoding: 'base64'}) | |
await browser.close() | |
const src = `data:image/jpeg;base64,${screenshot}` | |
res(new responseData(src, { name: 'screenshot' })) |
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
const browser: Browser = await puppeteer.launch() | |
const page: Page = await browser.newPage() | |
await page.setViewport({ width: 1440, height: 900 }) | |
await page.goto(url, { waitUntil: ['networkidle2'], timeout: 0 }) | |
const screenshot = await page.screenshot({ | |
type: 'jpeg', | |
encoding: 'base64', | |
quality: 50 | |
}) | |
await browser.close() |
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
// data | |
const grid : HTMLElement = document.querySelector('.grid') | |
const titleCell : HTMLElement = document.querySelector('.grid-title') | |
// UI | |
function addNewElement(startNum : number) { | |
let newCell : HTMLElement = document.createElement('div') | |
newCell.className = 'grid-cell' | |
let str :string = `<div class="title">${startNum}</div>` | |
for (let i = 1; i < 10; i++) { |
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
.grid-cell { | |
display: flex; | |
align-items: flex-end; | |
flex-wrap: wrap; // 讓內部 div 當空間不夠時可以自動換行 | |
flex-direction: column; // 讓內部 div 由上往下排列 | |
justify-content: space-between; // 讓內部的 div 內容可以去均分父元素橫的空間 | |
align-content: space-around; // 讓內部的 div 內容可以去均分父元素直的空間 | |
height: 350px; // 要設定固定高度,才會有 wrap 的效果 | |
} |
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
<script> | |
import { Line, mixins } from 'vue-chartjs' | |
const { reactiveProp } = mixins | |
export default { | |
mixins: [reactiveProp], | |
extends: Line, | |
data: () => ({ | |
options: { | |
responsive: true, |
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
{ | |
labels: ['今天', '昨天', '一週前'], // 位於 x 軸的各筆數據 key | |
datasets: [ | |
{ | |
label: '排名', // x 軸的標籤項目 | |
backgroundColor: 'rgba(0,0,0,0.1)', | |
data: ['1', '2', '1'] // 位於 y 軸對應的各筆數據 value | |
} | |
] | |
} |
NewerOlder