This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
class ImageUploadController | |
{ | |
public function saveToWebp($src, $destination, $extension) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Afghanistan", | |
"mobile_code": "+93", | |
"iso_code": "AF", | |
"flag_emoji": "🇦🇫" | |
}, | |
{ | |
"name": "Albania", | |
"mobile_code": "+355", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pytube import YouTube | |
yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo') | |
yt.streams.get_audio_only().download(filename="test.mp3") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from pytube import YouTube | |
import time | |
from urllib.parse import urlparse, parse_qs | |
import gradio as gr | |
def download_audio_from_youtube_url(url: str) -> gr.outputs.File: | |
filename = 'yt-audio-{timestamp}.mp4'.format(timestamp=round(time.time())) | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
btoa(Math.random()).substr(0, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request_payload = !empty($_POST) ? $_POST : array(); | |
$request_payload = empty($_POST) && !empty($_GET) ? $_GET : $request_payload; | |
$request_payload = isset($_SERVER['CONTENT_TYPE']) | |
&& $_SERVER['CONTENT_TYPE'] == 'application/json' | |
? json_decode(file_get_contents('php://input'), true) | |
: $request_payload; | |
$request_details = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_working_days($year, $month, $last_day = null) { | |
$total_month_days = date('t', strtotime("$year-$month-01")); | |
if ($last_day) { | |
$total_month_days = $last_day; | |
} | |
$working_days; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function send_json($payload, $status_code = 200) | |
{ | |
header('Access-Control-Allow-Origin: *'); | |
header('Content-Type: application/json'); | |
is_callable('http_send_status') ? http_send_status($status_code) | |
: header("HTTP/1.1 $status_code"); | |
return exit(json_encode((object) $payload)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addHyphens = (inputField) => { | |
inputField.addEventListener('input', (event) => { | |
let value = event.target.value.replace(/-/g, ''); | |
let formattedValue = ''; | |
for (let i = 0; i < value.length; i++) { | |
if (i === 5 || i === 12) { | |
formattedValue += '-'; | |
} | |
formattedValue += value[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const UsaStates = [ | |
'Alabama', | |
'Alaska', | |
'Arizona', | |
'Arkansas', | |
'California', | |
'Colorado', | |
'Connecticut', | |
'Delaware', | |
'Florida', |
OlderNewer