Skip to content

Instantly share code, notes, and snippets.

View alisalmabadi's full-sized avatar
🎯
Focusing

Ali Salmabadi alisalmabadi

🎯
Focusing
View GitHub Profile
@kodie
kodie / updateModified.js
Last active April 15, 2024 07:02
A JavaScript function for Google Sheets that updates a specific cell with the current date/time when cell(s) are updated.
function getColumnNumberByName(name, sheet) {
if (!sheet) {
sheet = SpreadsheetApp.getActiveSheet()
}
var headers = sheet.getDataRange().offset(0, 0, 1).getValues()[0]
var column = false
for (var i = 0; i < headers.length; i++) {
if (headers[i].trim() === name) {
@mahbodsh
mahbodsh / ProductResourceCollection.php
Last active July 13, 2023 03:42
Pagination helper in laravel resource
<?php
namespace App\Http\Resources;
use App\Helpers\ResourcePaginationHelper;
use Illuminate\Http\Resources\Json\ResourceCollection;
class ProductsResourceCollection extends ResourceCollection
{
/**
@mortezashojaei
mortezashojaei / OrdersComponent.tsx
Last active June 6, 2024 08:34
Using laravel-echo in reactjs
import React, { FC } from 'react';
import { useSocket } from '@myapp/hooks';
import {Order} from '@myapp/models';
export const OrdersComponent: FC = () => {
const [orders,setOrders] = useState<Order[]>();
function addNewOrder(neworder:Order) {
@bradtraversy
bradtraversy / docker_wordpress.md
Last active July 7, 2024 13:18
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@alisalmabadi
alisalmabadi / get_instagram_users_data.php
Last active January 26, 2019 08:26
by this php function you can get most of the important users data without Instagram api
function get_instagram_users_data($pageUrl) {
$url = $pageUrl;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
@moso
moso / app.js
Last active December 15, 2022 07:28
laravel-mix config
// jQuery import
global.jQuery = require('jquery');
var $ = global.jQuery;
window.$ = $;
// Bootstrap 4 depends on Popper.js
// Popper.js import
//import Popper from 'popper.js';
//window.Popper = Popper;
@amirasaran
amirasaran / Arabic character to Persian (Farsi) - PHP
Last active May 26, 2024 01:35
convert Arabic character to Persian (Farsi) - PHP
<?php
public static function arabicToPersian($string)
{
$characters = [
'ك' => 'ک',
'دِ' => 'د',
'بِ' => 'ب',
'زِ' => 'ز',
'ذِ' => 'ذ',
'شِ' => 'ش',
@erfansahaf
erfansahaf / SDate.php
Created December 16, 2015 22:43
a php class for work with Gregorian and Jalali dates
<?php
/* If you use Codeigniter framework, uncomment following ↓ line */
//defined('BASEPATH') OR exit('No direct script access allowed');
/*
* @name Shamsi Date (SDate)
* @author Erfan Sahafnejad <Erfan.Sahaf@gmail.com/>
* @copyright 2015 P30Skill Development Team (http://P30Skill.ir)
* @version 1.0
* @link www.P30Skill.ir
@miladkdz
miladkdz / national-code-validation-jquery
Created February 17, 2015 08:58
Iranian National Code Validation in jQuery
function checkNC(code) {
var L = code.length;
if (L < 8 || parseInt(code, 10) == 0) return false;
code = ('0000' + code).substr(L + 4 - 10);
if (parseInt(code.substr(3, 6), 10) == 0) return false;
var c = parseInt(code.substr(9, 1), 10);
var s = 0;
for (var i = 0; i < 9; i++)
s += parseInt(code.substr(i, 1), 10) * (10 - i);
@suziewong
suziewong / uploadfile.php
Created December 9, 2013 07:17
php_upload.php
<?php
if($_FILES['file']['name'] != '') {
if($_FILES['file']['error'] > 0) {
echo "错误状态:" . $_FILES['file']['error'];
} else {
$uuid = md5(uniqid(rand(), true));
move_uploaded_file($_FILES['file']['tmp_name'] , "uploads/" . $uuid . ".png");
echo "http://localhost:20001/".$uuid.".png";
}