Skip to content

Instantly share code, notes, and snippets.

View Bujupah's full-sized avatar
♟️
𝐅𝐫𝐞𝐞 𝐏𝐚𝐥𝐞𝐬𝐭𝐢𝐧𝐞 🇵🇸🇵🇸

Khalil Mejdi Bujupah

♟️
𝐅𝐫𝐞𝐞 𝐏𝐚𝐥𝐞𝐬𝐭𝐢𝐧𝐞 🇵🇸🇵🇸
  • Tunisia, TN
View GitHub Profile
@Bujupah
Bujupah / http_requests.gd
Last active May 22, 2024 21:27
The easiest way to use HTTP requests in Godot, way much similar to axios
class_name Request
extends Node
var http_request: HTTPRequest
var request_completed: bool = false
var response_data: Dictionary = {}
var response_error: int = OK
func _init():
@Bujupah
Bujupah / Show.tsx
Created May 17, 2024 17:13
Better way to handle the bulky conditions in tsx
import React, { ReactElement, Children, FC, ReactNode, isValidElement } from 'react';
interface WhenProps {
isTrue: boolean;
children: ReactNode;
}
interface ElseProps {
render?: ReactNode;
children?: ReactNode;
@Bujupah
Bujupah / install_terminal.ps1
Last active October 19, 2021 08:57
Script to make your windows powershell awesome again!
Write-Output 'Installing awesome tools for terminal...'`n
winget install Microsoft.WindowsTerminal --source winget --accept-package-agreements
winget install Microsoft.PowerShell --source winget --accept-package-agreements
winget install JanDeDobbeleer.OhMyPosh --accept-package-agreements
Install-Module -Name Terminal-Icons -Repository PSGallery
Install-Module -Name PSReadLine -RequiredVersion 2.2.0-beta1 -AllowPrerelease
Write-Output `n'Injecting terminal styles...'
$url = "https://gist.githubusercontent.com/Bujupah/c29abb0048e0fb5b2fca21d0f2aa94ad/raw"
@Bujupah
Bujupah / terminal.ps1
Created October 16, 2021 12:07
Awesome terminal
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
Import-Module -Name Terminal-Icons

Basic rules

  • Try to keep files small and focused.
  • Break large components up into sub-components.
  • Use spaces for indentation.

Naming conventions

Use PascalCase for:

@Bujupah
Bujupah / singleton.dart
Last active October 14, 2020 18:10
Using Dart's factory constructor to implement the singleton pattern
class MySingleton {
String var1;
int var2;
static MySingleton _instance;
factory MySingleton({String var1, int var2}) {
_instance == null
? print('New instance!')
: print('Old instance!');
@Bujupah
Bujupah / install.md
Last active June 24, 2020 16:27
Install PostgreSQL 9.6 + PostGIS

Install PostGIS and PostgreSQL

Installation of PostGIS and PostgreSQL is much simpler then you think. PostgreSQL is available in all Ubuntu versions by default. However, Ubuntu “snapshots” a specific version of PostgreSQL that is then supported throughout the lifetime of that Ubuntu version. Other versions of PostgreSQL are available through the PostgreSQL apt repository. The PostgreSQL apt repository supports LTS versions of Ubuntu (14.04 and 16.04) on amd64, i386 and ppc64el architectures as well as select non-LTS versions(17.04). While not fully supported, the packages often work on other non-LTS versions as well, by using the closest LTS version available. The following describes how to install Postgresql 9.6, PostGIS 2.3, pgRouting 2.3, PGAdmin on Ubuntu version 16.04. It is assumed to also work on Linux Mint, Lubuntu, and Xubuntu. Run these in terminal:

Verifying version of ubuntu

sudo lsb_release -a

Add Repository to sources.list

@Bujupah
Bujupah / install-postgres-postgis-gdal.sh
Created June 24, 2020 16:18 — forked from mdiener21/install-postgres-postgis-gdal.sh
Setup Ubuntu 16.04 for GIS development postgresql 9.6, postgis 2.3, gdal 2.1.2, python 3.5, pgrouting
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6
sudo apt-get install postgresql-9.6-postgis-2.3
sudo apt-get install postgresql-9.6-pgrouting
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@Bujupah
Bujupah / grafana
Last active May 29, 2020 12:22
a template to run queries from text panel
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<div>
// Some html logic
</div>
<script>
// Run query on text panel
function confirmQuery(query){
var data = {
"queries": [{
"refId": "A-random-refId",
import 'dart:async';
import 'dart:convert';
import 'package:mime/mime.dart';
import 'package:sv_rent_car/src/services/data_contract_service.dart';
import 'package:sv_rent_car/sv_rent_car.dart';
class MultiPartFormDataParser{
static Future<Object> multiPartData({Request request, Object object, String folder, Function onTextData, Function onFileData}) async {
final transformer = MimeMultipartTransformer(request.raw.headers.contentType.parameters["boundary"]);