Skip to content

Instantly share code, notes, and snippets.

View imanilchaudhari's full-sized avatar
💻
Learning Dart On Flutter

Anil Chaudhari imanilchaudhari

💻
Learning Dart On Flutter
View GitHub Profile
@imanilchaudhari
imanilchaudhari / gist:f3c0682b800cea1efdb7d28379c56007
Created November 28, 2022 18:18 — forked from dvlop/gist:fca36213ad6237891609e1e038a3bbc1
My long list of bad bots to block in htaccess, ready to copy and paste!
# Start Bad Bot Prevention
<IfModule mod_setenvif.c>
# SetEnvIfNoCase User-Agent ^$ bad_bot
SetEnvIfNoCase User-Agent "^12soso.*" bad_bot
SetEnvIfNoCase User-Agent "^192.comAgent.*" bad_bot
SetEnvIfNoCase User-Agent "^1Noonbot.*" bad_bot
SetEnvIfNoCase User-Agent "^1on1searchBot.*" bad_bot
SetEnvIfNoCase User-Agent "^3D_SEARCH.*" bad_bot
SetEnvIfNoCase User-Agent "^3DE_SEARCH2.*" bad_bot
SetEnvIfNoCase User-Agent "^3GSE.*" bad_bot
@imanilchaudhari
imanilchaudhari / geolocation-javascript.js
Created March 8, 2021 20:53
Get Browsers Geolocation
if (navigator.geolocation) {
navigator.geolocation.watchPosition (gotLocation, errLocation, {maximumAge: 30000});
}
function gotLocation (position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var accuracy = position.coords.accuracy;
var timestamp = position.timestamp;
}
We have detected that you have disabled your JavaScript. This website works best when JavaScript is enabled. Kindly enable JavaScript by using the following instructions.
To enable JavaScript for different browser:
Windows:
Google Chrome
To enable JavaScript for Google Chrome:
Go to the Chrome menu and select settings.
Click on Advanced link.
Under Privacy, click Content Settings.
<?php
class RandomUserAgent
{
public $browser_frequency = [
"Internet Explorer" => 11.8,
"Firefox" => 28.2,
"Chrome" => 52.9,
"Safari" => 3.9,
"Opera"=>1.8
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
The SQL being executed was: UPDATE merchant_products_master SET india_ban = 1, uae_ban = 1 WHERE LOWER(Title) LIKE "%bit axe%" AND category_id IN (2105000001, 2105150001, 2105161501, 2105162125, 2105162750, 2105163375, 2105164000, 2105164625, 2105165250, 2105165875, 2105166500, 2105173001, 2105173625, 2105174250, 2105174875, 2105175500, 2105184501, 2105185125, 2105185750, 2105186375, 2105196001, 2105196625, 2105197250, 2105197875, 2105207501, 2105208125, 2105208750, 2105300001, 2105311500, 2105323000, 2105450001, 2105461501, 2105462125, 2105462750, 2105463375, 2105464000, 2105464625, 2105465250, 2105473000, 2105484500, 2105496001, 2105496626, 2105496685, 2105496745, 2105497250, 2105497875, 2105498500, 2105499125, 2105499750, 2105500376, 2105500435, 2105500495, 2105507500, 2105600001, 2105611500, 2105623000, 2105634500, 2105750000, 2105900000, 2106050000, 2106200000, 2106350001, 2106361500, 210637300
<?php
public function actionProcess()
{
$customer = Yii::$app->user->identity;
$address = Yii::$app->session->get('address');
$apiContext = Yii::$app->paypal->_apiContext;
// set shipping address details
$shipping_address = new ShippingAddress();
@imanilchaudhari
imanilchaudhari / vhost.example.conf
Created February 26, 2019 09:13
Apache Virtual hosts examples http, https both
# example.com.conf:
<VirtualHost *:80>
ServerName example.com
ServerAdmin [email protected]
DocumentRoot /var/www/example.com/html
<Directory /var/www/example.com/html>
Options FollowSymLinks
AllowOverride None
Require all granted

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

<?php
foreach($shipments as $shipment){
$box = Boxes::model()->getBoxFromShipmentId($shipment->shipment_id);
$box_item = BoxItems::model()->findByAttributes(array('box_id' => $box->box_id));
$shipment_data = array();
$s_address = Address::model()->getAddress($shipment->shipper_id); //shipper address
$shipment_data['Shipper'] = array(
'Contact' => array(
@imanilchaudhari
imanilchaudhari / git-change-commit-messages.md
Created January 14, 2019 06:17 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.