Skip to content

Instantly share code, notes, and snippets.

View Aghaie's full-sized avatar
💭
I may be slow to respond.

Ali Aghaie Aghaie

💭
I may be slow to respond.
View GitHub Profile
@altwitt
altwitt / animated-3d-globe-webgl-three-js.markdown
Created November 30, 2019 03:46
Animated 3D Globe (WebGL/three.js)
@yehgdotnet
yehgdotnet / install_phpzip.md
Last active February 7, 2023 13:14
MAMP PRO for Mac OSX - Installing PHP ZIP extension

From Terminal

# install dependencies
brew install autoconf # required by pecl 
brew install libzip


# install zip extenion in your selected MAMP PHP version 
ls /Applications/MAMP/bin/php/
@mraaroncruz
mraaroncruz / steps.md
Last active July 30, 2025 12:56
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@sh-sh-dev
sh-sh-dev / DigikalaProduct.php
Last active February 1, 2025 09:11
Digikala Products Info
<?php
function digikalaProduct($PID) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.digikala.com/v1/product/$PID/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36");
$output = curl_exec($ch);
curl_close($ch);
return $output;
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@atinux
atinux / async-foreach.js
Last active April 2, 2025 11:34
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@apphancer
apphancer / install_wkhtmltopdf_on_centos.sh
Last active May 31, 2020 21:58
Install wkhtmltopdf 0.12.4 on CentOS 6.x and 7.x
# Install dependencies (if needed)
$ yum install -y xorg-x11-fonts-75dpi
$ yum install -y xorg-x11-fonts-Type1
$ yum install xz
# Get latest version of wkhtmltopdf (replace version number if needed)
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
# Untar and move wkhtmltox
$ unxz wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
@proweb
proweb / slick_fix.css
Created May 6, 2017 16:23
Css fix for slick carousel in bootstrap 3 tab
/* Based on https://github.com/kenwheeler/slick/issues/187#issuecomment-59123524 */
/* bootstrap hack: fix content width inside hidden tabs */
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: block; /* undo display:none */
height: 0; /* height:0 is also invisible */
overflow: hidden; /* no-overflow */
}
.tab-content > .active,
.pill-content > .active {
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active June 29, 2025 14:27 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@chrisiona
chrisiona / ttfb.sh
Last active November 12, 2020 09:11
TTFB – Bash script that returns interesting information about a HTTP/S call
#!/bin/bash
# Returns interesting information about a HTTP/S call
# http://chrisiona.com/post/125309997618/ttfb-a-bash-script-that-returns-interesting
curl -so /dev/null \
-w "Response Code: \t\t%{http_code} \
\nName Resolution: \t%{time_namelookup} sec\
\nConnect Time: \t\t%{time_connect} sec\
\nPre Transfer: \t\t%{time_pretransfer} sec\