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
package controllers; | |
public class Application extends Controller { | |
// in cache during 1800 seconds (30 min) | |
@Cached(key = "pagingList", duration = 1800) | |
public static Result index(Integer page) { | |
String uuid = session("uuid"); | |
if (uuid == null) { | |
uuid = java.util.UUID.randomUUID().toString(); |
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
private static Boolean handleProfilePictureUpload(User user, Request request) { | |
Boolean isChanged = Boolean.FALSE; | |
Http.MultipartFormData body = request.body().asMultipartFormData(); | |
Http.MultipartFormData.FilePart uploadFilePart = body | |
.getFile("picture"); | |
if (uploadFilePart != null) { | |
File file = uploadFilePart.getFile(); | |
ImageUtilities.scale(file, 50, 50); // x = 50px y = 50px | |
S3File s3File = new S3File(); |
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\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Annotation\Route; | |
class HomepageController extends AbstractController | |
{ |
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 | |
require 'vendor/autoload.php'; | |
// use an html version of the contract exported from Microsoft Word, to avoid having to deal with word formatting issues | |
$html = file_get_contents(__DIR__ . '/contract.html'); | |
// Assuming you have a function that can split the HTML content into manageable chunks | |
// This is a placeholder; you'd need to implement or find a suitable way to split the HTML. | |
$chunks = split_html_into_chunks($html, 4000); // Split HTML into chunks of up to 4000 tokens |
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 | |
require __DIR__ . '/vendor/autoload.php'; | |
$openApiKey = 'OPEN_API_KEY"; | |
$botToken = 'BOT_TOKEN'; | |
$apiURL = "https://api.telegram.org/bot$botToken/"; | |
$offset = 0; | |
// Function to send messages via Telegram |
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 | |
require_once 'vendor/autoload.php'; | |
// Function to convert text to speech using Google Cloud Text-to-Speech API | |
function textToSpeech($text, $serviceAccountPath) { | |
// Create and configure a new client object | |
$client = new Google_Client(); | |
$client->setAuthConfig($serviceAccountPath); | |
$client->addScope('https://www.googleapis.com/auth/cloud-platform'); | |
$httpClient = $client->authorize(); |
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\Livewire; | |
use Illuminate\Support\Facades\Http; | |
use Illuminate\Support\Facades\Storage; | |
use Livewire\Component; | |
use Livewire\WithFileUploads; | |
class ImageChecker extends Component |