Skip to content

Instantly share code, notes, and snippets.

@Linch1
Linch1 / tokenPriceApi.js
Last active November 3, 2024 21:17
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js
@AlCalzone
AlCalzone / how-to-async.md
Last active February 7, 2023 10:38
JavaScript: How to Async? (german)

How to? - Asynchroner Code

Kapitel 1: Synchroner Code

Ausgangslage: Synchroner Code. Einfach zu lesen, klarer Programmablauf:

const ergebnis1 = synchroneFunktion1();
const ergebnis2 = synchroneFunktion2();
tueWasMitErgebnis(ergebnis1, ergebnis2);
<?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;
@Gkiokan
Gkiokan / json-encode-decode-class.php
Created January 8, 2018 10:04
JSON full encode decode with UTF-8 support
/*
Data Class
* * * * * * *
Author: Gkiokan
Comment:
Encode and Decode Your String / Object / Array with utf-8 force.
*/
class Data {
// Encode
@poul-kg
poul-kg / valet.conf
Last active September 18, 2024 17:32
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
@Gkiokan
Gkiokan / .htaccess
Created September 12, 2017 10:58
The WPMS non-www to www but grant access to wp-* problem in htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
@Gkiokan
Gkiokan / alias.sh
Last active September 14, 2017 08:23
Alias mapping in terminal
echo " > Loading Aliases "
# Basics
alias ..="cd .."
alias lsa="ls -al"
alias swatch="sass --watch "
alias sfull="sass --watch sass:css --style=compressed"
alias sf="sfull"
alias m="~/.dotfiles/mount.sh"
alias s="source ~/.dotfiles/server.sh"
@squarestar
squarestar / install-wp-plugins.php
Last active November 16, 2024 19:57
Programmatically install and activate wordpress plugins
<?php
/**
* Programmatically install and activate wordpress plugins
*
* Usage:
* 1. Edit the $pluginSlugs array at the beginning of this file to include the slugs of all the
* plugins you want to install and activate
* 2. Upload this file to the wordpress root directory (the same directory that contains the
* 'wp-admin' directory).
* 3. Navigate to <your-domain-wordpress-root>/install-wp-plugins.php (If wordpress is installed
@pythoninthegrass
pythoninthegrass / cask_gist.txt
Last active May 2, 2020 18:17 — forked from jitendravyas/gist:8d35b092dd9102a05ea3
Brew Cask installation with Laptop script
#!/bin/sh
# homebrew taps
brew tap caskroom/cask
brew tap caskroom/versions
brew tap homebrew/boneyard
brew tap caskroom/fonts
# Updated grep
@solancer
solancer / apache-nginx-ftp
Created July 27, 2016 10:53
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;