Skip to content

Instantly share code, notes, and snippets.

View rana01645's full-sized avatar

Afjalur Rahman Rana rana01645

View GitHub Profile
write a php api class for this
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "What is the OpenAI mission?"}]
}'
Write a sql query to retrieve information about customers, their orders, and the products they ordered. It should return results for customers in New York who placed orders in the year 2022 for products with a quantity of at least 5. The results should be sorted first by order date in descending order, then by product name in ascending order.
Give me the main gist of this
Hooks
TOPICS
Actions vs. Filters
More Resources
Hooks are a way for one piece of code to interact/modify another piece of code at specific, pre-defined spots. They make up the foundation for how plugins and themes interact with WordPress Core, but they’re also used extensively by Core itself.
There are two types of hooks: Actions and Filters. To use either, you need to write a custom function known as a Callback, and then register it with a WordPress hook for a specific action or filter.
1. Transform code from one language to another
Prompt:
Write this code in Java
<?php
class Animal
{
@rana01645
rana01645 / database.php
Created August 23, 2022 20:21
Singlestore Db
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
<?php
namespace App\Acme;
use Carbon\Carbon;
// now, this class only gets the sales between the given dates.
// It doesn't deal with how with sales are stored, it doesn't
// deal with how to format the output, it doesn't deal with Auth
class SalesReporter
@rana01645
rana01645 / early-stopping.ipynb
Created August 15, 2021 14:37
early-stopping.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04
#install necessary libs
sudo apt update
sudo apt install python3-pip python3-dev libpq-dev nginx curl
#install mysql
sudo apt install mysql-server
sudo apt-get install libmysqlclient-dev
@rana01645
rana01645 / laravel can't read environment url
Created April 27, 2021 22:04
laravel can't read environment url
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear