Skip to content

Instantly share code, notes, and snippets.

View mumin91's full-sized avatar
🎯
Focusing

Muminur Rahman mumin91

🎯
Focusing
View GitHub Profile
@mumin91
mumin91 / language_by_locale.ts
Created August 24, 2023 06:05
(Note: This list is not exhaustive, and some language codes may be missing or vary between different systems.) Each locale typically consists of a language code and a country code, separated by an underscore or hyphen. For example, `en_US` denotes English as spoken in the United States, while `fr_CA` denotes French as spoken in Canada. The langu…
enum LanguageByLocale {
af_NA = 'Afrikaans (Namibia)',
af_ZA = 'Afrikaans (South Africa)',
af = 'Afrikaans',
ak_GH = 'Akan (Ghana)',
ak = 'Akan',
am_ET = 'Amharic (Ethiopia)',
am = 'Amharic',
ar_001 = 'Arabic (World)',
ar_AE = 'Arabic (United Arab Emirates)',
@mumin91
mumin91 / models.py
Created March 25, 2020 16:26
Recursive chain comment model in Django
class Comment(models.Model):
comment = models.CharField(max_length=300)
blogpost = models.ForeignKey(Blogpost, on_delete=models.CASCADE)
commenter = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
parent = models.ForeignKey('self', null=True, blank=True, related_name='replies', on_delete=models.CASCADE)
<?php
$servername="localhost";
$username="root";
$password="";
$dbname="raha";
$conn=mysqli_connect($servername,$username,$password,$dbname);
if($conn)
{
if(isset($_POST['submit']))
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body onload="startTheGame();">
<h1>Hello, Enter your details</h1>
@mumin91
mumin91 / views.py
Created November 28, 2018 10:39
Then trying to get user data through WP API.
def get_data(request, user_id, nons):
customer = services.wc_api_call('customers/' + user_id).json()
print(nons)
print(customer)
print(customer['email'])
obj, created = CustomUser.objects.get_or_create(password=make_password("1234567"),
is_superuser=False,
username=customer['username'],
first_name= customer['first_name'],
last_name= customer['last_name'],
@mumin91
mumin91 / redirect.php
Created November 28, 2018 10:35
Riderect user to django app after logging in to the wordpress.
<?php
/**
* Plugin Name: Ethis Redirect
* Description: A simple plugin to send users to EthisCrowd dashboard after logging in dynamically with user id
*/
function redirect_user_to_db( $redirect_to, $user )
{
//is there a user to check?
# view.py
def get_posts():
posts = Post.objects.all()
return render(request, 'post.html' {'posts' : posts})
#template
{{ posts|length }}
<?php
namespace App\Jobs;
use App\Podcast;
use App\AudioProcessor;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
<?php
$myObject = new MyClass;
$myObject->addTwoNumbers(2,4);
$myObject->subtractTwoNumbers(4,2);
?>
<?php
class MyClass
{
use easyMath;
}
?>