Skip to content

Instantly share code, notes, and snippets.

View faridfr's full-sized avatar
🎭
Wait for it ...

Farid Froozan faridfr

🎭
Wait for it ...
View GitHub Profile
@faridfr
faridfr / .htaccess
Created December 21, 2019 11:49
Disable Gzip for filesize in downloading
SetEnv no-gzip dont-vary
@faridfr
faridfr / afterTextChanged.js
Last active May 11, 2019 14:37
afterTextChanged in html and javascript
// Use ( onkeyup="afterTextChanged(this);" ) in your input element
// This function works after user typing . You can change sensivity in line 17
oldKey = 0,differenceInKeyTime = 0,newKey = 0,interval = 0;
function afterTextChanged (element){
if(element.value.length == 0)
return 0;
oldKey = new Date();
clearInterval(interval);
@faridfr
faridfr / MonthlyChartBackEndLaravel.php
Last active October 11, 2022 16:48
Monthly Chart Back End Laravel With Jalali Dates
<?php
$results['x'] = [];
$results['y'] = [];
$results['xy'] = [];
for($i=30;$i>=0;$i--)
{
$x = date('Y-m-d',strtotime('-'.$i.' days'));
$y = Order::where('created_at','like','%'.$x.'%')
@faridfr
faridfr / HourlyChartResponse.json
Created April 25, 2019 11:49
Hourly Chart Response in json
{
"data": {
"hourlyChart": {
"xAxis": [
"08",
"09",
"10",
"11",
"12"
],
@faridfr
faridfr / HourlyChartBackEndLaravel.php
Last active October 11, 2022 16:48
Hourly Chart Back End Code In Laravel
<?php
$posts = \DB::select("
Select date_format(created_at, '%H') as hour, count(id) as count
From posts WHERE deleted_at IS NULL
Group by date_format(created_at, '%H')
");
$xAxis = array();
$yAxis = array();
@faridfr
faridfr / persian_trello.css
Created April 14, 2019 18:38
فارسی کردن وبسایت trello
* :not([class *= "icon-"]) {
font-family:iranYekan !important;
}
input,textarea,.js-checkitem-name {
display:block;
direction:rtl !important;
text-align:right !important;
}
a.action-card {
direction:rtl;
@faridfr
faridfr / psfc.php
Created June 5, 2018 16:01
preparing string for compare
<?php
function psfc ($string){
$string =
strtolower(str_replace(' ', '',convert_numbers_to_english(preg_replace('/\s+/', '', $string))));
return $string;
}
function convert_numbers_to_english($string) {
@faridfr
faridfr / laravel_kavenegar_class.php
Created April 23, 2018 21:41
Laravel Kavenegar.com class
<?php
// you need GuzzleHttp to send requests
// set your configs in properties
// use like this :
// $sms = new \App\Kavenegar();
// $sms = $sms->verify($username,$smstype,$tokens)->getStatusCode();
namespace App;
@faridfr
faridfr / morilog_jdate_helpers.php
Last active January 15, 2020 09:02
laravel morilog jalali to gregorian helper functions
<?php
// work with ( https://github.com/morilog/jalali ) , to send jalali datetime and get gregorian datetime
// example : jalali_to_gregorian('1397-01-29 20:20:20)
function jalali_to_gregorian ($jalali){
$miladi_array = \Morilog\Jalali\jDateTime::toGregorian(
datetime_slice($jalali,'year'),
datetime_slice($jalali,'month'),