Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

chautran tranchausky

🏹
done
View GitHub Profile
@tranchausky
tranchausky / firebase-login-regisnter-email.html
Created October 18, 2022 15:26
firebase demo login Authenticate
<!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" />
<title>Firebase Example</title>
<style>
@tranchausky
tranchausky / lastversion.php
Last active October 26, 2022 03:04
php return last time of folder when edit file
<?php
$files = array_merge(glob("../lib/*.css"), glob("../lib/*.js"));
$files = array_combine($files, array_map("filemtime", $files));
arsort($files);
$latest_file = key($files);
$time = filemtime($latest_file);
echo $time; //int time
<?php
/**
* shortens the supplied text after last word
* @param string $string
* @param int $max_length
* @param string $end_substitute text to append, for example "..."
* @param boolean $html_linebreaks if LF entities should be converted to <br />
* @return string
*/
@tranchausky
tranchausky / html5-play-video.html
Created October 26, 2022 03:03
html5 background and no load video first
<video id="background-video" loop muted controls preload="none" poster="https://assets.codepen.io/6093409/river.jpg">
<source src="https://assets.codepen.io/6093409/river.mp4" type="video/mp4">
</video>
@tranchausky
tranchausky / run.html
Created October 26, 2022 08:14
show time run javascript
<label id="minutes">00</label>:<label id="seconds">00</label>
<script>
//https://stackoverflow.com/a/5517836
var minutesLabel = document.getElementById("minutes");
var secondsLabel = document.getElementById("seconds");
var totalSeconds = 0;
setInterval(setTime, 1000);
@tranchausky
tranchausky / javascript play,pause audio.html
Created October 27, 2022 04:28
javascript preload meta audio and play,pause
<html>
<body>
<audio id="myAudio" src="FurElise.mp3" preload="metadata"></audio>
<input type="button" value="sound" onclick="togglePlay1()" />
<script>
//FurElise.mp3
@tranchausky
tranchausky / php get instagram.php
Created October 27, 2022 09:18
get last post of profile in instagram
<?php
//https://toplist.vn/top-list/hot-girl-viet-dep-nhat-tren-instagram-20537.htm
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://i.instagram.com/api/v1/users/web_profile_info/?username=linggka109',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
@tranchausky
tranchausky / php-hash.php
Created October 28, 2022 08:35
php list hash string, and compare speed
PHP hash string
https://www.php.net/manual/en/function.hash.php
<?php
$str = "hello";
$checksum = crc32($str);
echo $checksum.'<br>';
echo hash("crc32b", $str);
@tranchausky
tranchausky / instagram_get.php
Created October 28, 2022 08:41
php get instagram user
<?php
class Instagram{
private $data = [];
private $user = '';
private $rs_request = null;
private $minus_cache = 20;//minus
private $folder_thump = 'thump';
private $save_thump_320 = '320';
public function __contructor(){
@tranchausky
tranchausky / php-random-string.php
Created October 28, 2022 09:04
php random string
echo generateRandomString(7);
echo '<br>';echo '<br>';echo '<br>';echo '<br>';
function generateRandomString($length = 6){
$chars = "abcdfghjkmnpqrstvwxyz|ABCDFGHJKLMNPQRSTVWXYZ|0123456789";
$sets = explode('|', $chars);
$all = '';
$randString = '';