Skip to content

Instantly share code, notes, and snippets.

View mohamadaliakbari's full-sized avatar
💭
Coding new project

Mohammad Ali Akbari mohamadaliakbari

💭
Coding new project
View GitHub Profile
@mohamadaliakbari
mohamadaliakbari / tailwindcss-with-plugin-standalone.md
Last active December 13, 2021 21:16
How to install Tailwind CSS standalone with plugins

Setup

enviroment with tailwindcss + plugins

Source: https://tailwindcss.com/docs/installation#using-tailwind-cli

Install and init

  • Install core utilities: npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
  • Init project: npx tailwindcss init this will create tailwind.config.js

Create stylesheets

@mohamadaliakbari
mohamadaliakbari / wordpress-find-block-delete-spammers.md
Last active December 9, 2021 08:25
Find, Block and Delete spammers in wordpress

Find spammer IPs (IP with more than 1 unapproved comment)

select comment_author_IP from wp_comments where comment_approved = '0' group by comment_author_IP, comment_approved having count(*) > 1;

Convert to simple ip list using text-editor and REGX

Bulk check ip locations using https://app.ipapi.co/bulk/

Convert to propper format and insert into /etc/nginx/conf.d/blacklist.conf

@mohamadaliakbari
mohamadaliakbari / upgrade-bootstrap-to-latest-version-in-laravel-8.md
Last active February 3, 2021 11:19
Upgrade bootstrap to latest version in Laravel 8

Upgrade Bootstrap

npm uninstall --save-dev bootstrap
npm install --save-dev bootstrap@next

Upgrade Popper

npm uninstall --save-dev popper.js
npm install @popper.js/core --save-dev
@mohamadaliakbari
mohamadaliakbari / full-height-sidebar-menu-using-flex.md
Created May 23, 2019 11:33
Full height sidebar menu ready for responsive design just using flex.
  html, body {
    height: 100%;
  }

  #app {
    display: flex;
    min-height: 100%;
  }
@mohamadaliakbari
mohamadaliakbari / elastiquent-paginate.md
Last active December 3, 2018 15:26
Paginate Elastiquent searchByQuery with getAggregations
$entities = Entity::searchByQuery($query, $aggregation_criteria, NULL, 36, ($request->get('page', 1) - 1) * 36);
$aggregations = $entities->getAggregations();
$entities = new LengthAwarePaginator($entities, $entities->totalHits(), 36, LengthAwarePaginator::resolveCurrentPage(), array('path' => LengthAwarePaginator::resolveCurrentPath()));
@mohamadaliakbari
mohamadaliakbari / ubuntu-run-dhclient-on-startup.md
Last active November 6, 2023 19:33
Run dhclient on Startup in Ubuntu 18.04

dhclient is the Dynamic Host Configuration Protocol (DHCP) Client one would use to allow a client to connect to a DHCP server.

$ sudo nano /etc/rc.local

#!/bin/bash
dhclient
exit 0
@mohamadaliakbari
mohamadaliakbari / run-mariadb-from-home.md
Created August 12, 2018 13:21
To run MariaDB SQL from `/home`

To run MariaDB SQL from /home, in the file /usr/lib/systemd/system/mariadb.service, just change :

ProtectHome=true

to :

ProtectHome=false

@mohamadaliakbari
mohamadaliakbari / structure-of-multi-part-data-form-request.md
Created July 11, 2018 07:22
Structure of multi-part data form request

There are a few ways to accomplish posting a photo from an iPhone or iPad to a REST API but the method I’ve found to be the most useful is to create a multi-part form request for the task.

It would be nice to just send the byte stream up on its own, but typically you need to attach some other models or data to the request so that you know what context to place the image into on the server. Borrowing from good old HTML Forms, this method will allow you to submit a whole bunch of data in a variety of formats in a single shot.

As well as this works, there is something unpleasant about generating a multi-part form request for iOS. It’s a specific structure like any other data format, but it’s got some peculiarities that make it feel...hackish. Here is an example of a multi-part form request so you can see what will ultimately be generated:

POST /path/to/script.php HTTP/1.0
Host: example.com
Content-type: multipart/form-data, boundary=AaB03x
@mohamadaliakbari
mohamadaliakbari / setup-ipfs-mine-filecoin.md
Last active June 21, 2018 08:30
Setup IPFS and start earning FileCoin
@mohamadaliakbari
mohamadaliakbari / sdm.tarafdari.com-dev-version.md
Created May 19, 2018 08:24
Create database dev version for sdm.tarafdari.com
  • Create sdm_temp from main sdm backup.
  • List all tables with their rows: SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sdm_temp' order by table_rows;
  • Truncate all non-core tables with huge data.