Skip to content

Instantly share code, notes, and snippets.

/**
* This file is responsible for caching mongo model instance for specific time.
* Usage example:
* Store.findOne(query, fields).cacheResults(1 * 60).exec(); // it'll cache result for specified seconds
* Store.findOne(query, fields).removeCache().exec(); // it'll remove any existing cache
*/
// @ts-nocheck
import mongoose from 'mongoose';
import objectToFormData from 'objectToFormData';
let test_obj = {
a: 'b'
};
let formDataObj = objectToFormData(test_obj);
axios.post('your url', formDataObj);
@zisan34
zisan34 / timezones_array.php
Created March 11, 2021 06:18 — forked from pavellauko/timezones_array.php
Time zones as arrays (PHP)
<?php
$timezones = array(
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
@zisan34
zisan34 / ChunkUploadController.php
Last active March 10, 2021 04:59
Vue-Laravel Large File Upload by Chunk Upload.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class ChunkUploadController extends Controller
{
private function storage()
@zisan34
zisan34 / component
Created February 25, 2021 04:07
React-filedrop-component //credit:30 seconds of knowledge
function FileDrop(props) {
const [drag, setDrag] = React.useState(false);
const [filename, setFilename] = React.useState('');
let dropRef = React.createRef();
let dragCounter = 0;
const handleDrag = e => {
e.preventDefault();
e.stopPropagation();
};
@zisan34
zisan34 / AppServiceProvider.php
Created February 17, 2021 04:25 — forked from paulund/AppServiceProvider.php
Laravel Cache Auth::user(). Learn how to cache the logged in user at https://paulund.co.uk/laravel-cache-authuser
<?php
namespace App\Providers;
use App\Models\User;
use App\Observers\UserObserver;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@zisan34
zisan34 / App_Http_VideoStream.php
Created November 30, 2020 19:49 — forked from vluzrmos/App_Http_VideoStream.php
Laravel VideoStream.
<?php
namespace App\Http;
/**
* Description of VideoStream
*
* @author Rana
* @link https://gist.github.com/vluzrmos/d5682ad426525196d069
*/
@zisan34
zisan34 / delete-hidden-files.php
Created October 28, 2020 09:04 — forked from Robiussani152/delete-hidden-files.php
Ftp related important files.
<?php
/**
* Find and delete all hidden files in $dir
* Usage: remove-hidden-files.php OR remove-hidden-files.php /path/to/parse/
*
* Without path parameter, the current path is being used.
*
* (C)ommitted 2015 by @author Fabian Wolf (@link http://usability-idealist.de/)
*
* @license GNU GPL v3