Skip to content

Instantly share code, notes, and snippets.

View phuoctamm's full-sized avatar

Phuoc Tam phuoctamm

View GitHub Profile
@phuoctamm
phuoctamm / cau1.java
Created February 24, 2023 06:32
cau1
import java.util.Arrays;
import java.util.Scanner;
public class Cau1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Nhập số phần tử của mảng, dùng vòng lặp while kiểm tra điều kiện, nếu nhập dưới hoặc bằng 3 sẽ chạy lại vòng lặp tới khi nào ta nhận được > 3
int n = 0;
while (n <= 3) {
@phuoctamm
phuoctamm / parsetime.js
Created October 12, 2021 08:13
parse.js
export const toDateParse = (date, dateFormat = 'MM/dd/yyyy') => {
try {
return parse(date, dateFormat, new Date());
} catch (e) {
return false;
}
};
@phuoctamm
phuoctamm / test.php
Created March 15, 2021 07:25
test.php
$ids = [1, 2, 3, 4, 5];
foreach($ids as $id) {
$total = Service::GetPrice($id, Auth::user()->role) * $data["amount"];
if($total > Auth::) .... {
return "so du ko du";
}
}
[{"option1":"X-Large Premium Blanket","origin_price":true,"price":"65.50"},{"option1":"Large Premium Blanket","origin_price":true,"price":"60.50"},{"option1":"Youth Premium Blanket","origin_price":true,"price":"55.50"}]
@phuoctamm
phuoctamm / data.json
Created September 21, 2020 16:27
datajson
{
"JNUG": {
"RSI": 56.14481391285456,
"h": [
{
"low": 138.33,
"high": 143.15,
"volume": 214366,
"open": 140.84,
"close": 140,
// manifest.json
{
"web_accessible_resources": ["data.txt"] // add this
}
// get
const url = chrome.runtime.getURL('data.txt'); //path to file
fetch(url)
.then(response => response.text())
const array = [
{
id: 1,
name: 'Monkey'
},
{
id: 2,
name: 'Lion'
},
{
async function someFunction() {
const myArray = [1, 2, 3];
const connection = mysql.createPool({ options });
let finalArray = [];
myArray.forEach((value) => { // standard forEach
finalArray.push(asyncFunction(connection, value).then((result) => {
finalValue.asyncFunctionValue = result.asyncFunctionValue; // giving instructions
return finalValue; // important to return the value
}));
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>