Skip to content

Instantly share code, notes, and snippets.

View fanfan1609's full-sized avatar
🎯
Focusing

VO QUOC DAT fanfan1609

🎯
Focusing
View GitHub Profile
@fanfan1609
fanfan1609 / csv_compare.php
Created October 4, 2023 14:19
csv compare
<?php
$csv_1 = "xxx.csv"; // old_file
$csv_2 = "yyy.csv"; // new_file
$result_csv = "zzz.csv";
// read csv file into array
$csv_1_array = array_map('str_getcsv', file($csv_1));
$csv_2_array = array_map('str_getcsv', file($csv_2));
// change key by column number
@fanfan1609
fanfan1609 / JP.txt
Created August 21, 2023 08:10
Japanese
DELETE ME - Must create a new gist with an initial file
DELETE ME - Must create a new gist with an initial file
@fanfan1609
fanfan1609 / array_sub_max_sliding.php
Created June 6, 2023 02:55
Sliding to calculate sum of k from Array
function maxSumOfKConsecutive($arr, $k) {
$n = count($arr);
$maxSum = 0;
// Calculate the sum of the first 'k' elements
for ($i = 0; $i < $k; $i++) {
$maxSum += $arr[$i];
}
$currentSum = $maxSum;
@fanfan1609
fanfan1609 / longest-substring-without-repeating-characters.php
Created June 6, 2023 02:15
Leetcode : longest-substring-without-repeating-characters
<?php
// Original problem : https://leetcode.com/problems/longest-substring-without-repeating-characters/submissions/964797814/
$s = "bbbbb";
// output = 3;
echo lengthOfLongestSubstring($s);
function lengthOfLongestSubstring($s) {
if(empty($s)) return 0;
$n = strlen($s);
@fanfan1609
fanfan1609 / export-chat.js
Last active February 16, 2023 08:41 — forked from schnabear/export-chat.js
ChatWork Export Chat
let room_id = 26059xxx;
let myid = 664xxx4
let token = "9ea08b3b75d344100773333086ca22e6c76f458a63ed71d023xxx";
let first_chat_id = '167282491827159xxx'
let chat_ids = [];
let other_ids = [];
fetchChat(myid, room_id, first_chat_id, _t);
Canva: thiết kế bài post trên IG,pp
Unsplash: lấy h/a nét
Pexels:lấy video free
Genially:sáng tạo content,slide thuyết trình.
DELETE ME - Must create a new gist with an initial file
@fanfan1609
fanfan1609 / __upload_file.md
Created November 25, 2022 08:08 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@fanfan1609
fanfan1609 / instruction.md
Last active November 7, 2022 00:54
NPP Instruction

Project Instruction

Set up

Web Server and Run

  • You can run this project without using any web server such as Apache or Ngix by using php artisan serve, but I recommend you should use web server because it is faster than using php artisan serve