Skip to content

Instantly share code, notes, and snippets.

View hyperionstudios's full-sized avatar

Ahmad Alsodani hyperionstudios

View GitHub Profile
@hyperionstudios
hyperionstudios / generatingTextFromLoopInList.dart
Last active April 13, 2021 03:28
An example to generate a list of range values from-to in a list
// This will create a list of elements 0m - 50m all the way to 1150m - 2000m depends on inclusion or exclusion of the 2000
List _increments50Text = [
for (int i = 0; i < 2000; i += 50)
(i.toString() + 'm - ' + (i + 50).toString() + 'm')
];
// same as above example but with a 100 increments instead of 50
List _increments100Text = [
for (int i = 0; i < 2000; i += 100)
@hyperionstudios
hyperionstudios / isolating_field_columns_model.php
Last active April 1, 2021 04:51
Proof of concept, where dividing the Product model into multiple models like VariableProduct,RentableProduct, etc but we still using one table and each model deals with its own columns and attribute
<?php
namespace App;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Support\Arr;
@hyperionstudios
hyperionstudios / random_key.php
Last active April 12, 2021 08:10
Generate a random key, can be used for Authentication or Confirmation of an Action
<?php
function generateRandomKey( $length = 6 , $withLetters = false ): string
{
$chars = $withLetters ? str_shuffle('0W1E2R3T4Y5U6I7O8P9A0S9D8F7G6H5J4K3L2M1NBVCXZ') : str_shuffle('3759402687094152031368921');
$chars = str_shuffle(str_repeat($chars, ceil($length / strlen($chars))));
return strrev(str_shuffle(substr($chars, mt_rand(0, (strlen($chars) - $length - 1)), $length)));
}
@hyperionstudios
hyperionstudios / flutter_bottomsheet_with_state.dart
Created August 26, 2020 03:57
Flutter create bottomsheet with state, state can be managed from within the scaffold key to send messages from wisget to the bottomsheet
Future _createBottomSheet(BuildContext context) async {
// BottomSheet with state controller by the _scaffoldKey
// PersistentBottomSheetController _bottomSheetController;
// final _scaffoldKey = GlobalKey<ScaffoldState>();
if (_bottomSheetController == null) {
_bottomSheetController = _scaffoldKey.currentState.showBottomSheet(
(context) {
return Container(
height: MediaQuery.of(context).size.height * 0.75,
color: Colors.grey,
@hyperionstudios
hyperionstudios / last_names.php
Created August 24, 2017 07:10 — forked from subodhghulaxe/last_names.php
List of last names as php array
<?php
$last_names = array(
'Abbott',
'Acevedo',
'Acosta',
'Adams',
'Adkins',
'Aguilar',
'Aguirre',
'Albert',
@hyperionstudios
hyperionstudios / array-names.py
Created August 24, 2017 07:10 — forked from ruanbekker/array-names.py
Array of First Names
names = ["Aaran", "Aaren", "Aarez", "Aarman", "Aaron", "Aaron-James", "Aarron", "Aaryan", "Aaryn", "Aayan", "Aazaan", "Abaan", "Abbas", "Abdallah", "Abdalroof", "Abdihakim", "Abdirahman", "Abdisalam", "Abdul", "Abdul-Aziz", "Abdulbasir", "Abdulkadir", "Abdulkarem", "Abdulkhader", "Abdullah", "Abdul-Majeed", "Abdulmalik", "Abdul-Rehman", "Abdur", "Abdurraheem", "Abdur-Rahman", "Abdur-Rehmaan", "Abel", "Abhinav", "Abhisumant", "Abid", "Abir", "Abraham", "Abu", "Abubakar", "Ace", "Adain", "Adam", "Adam-James", "Addison", "Addisson", "Adegbola", "Adegbolahan", "Aden", "Adenn", "Adie", "Adil", "Aditya", "Adnan", "Adrian", "Adrien", "Aedan", "Aedin", "Aedyn", "Aeron", "Afonso", "Ahmad", "Ahmed", "Ahmed-Aziz", "Ahoua", "Ahtasham", "Aiadan", "Aidan", "Aiden", "Aiden-Jack", "Aiden-Vee", "Aidian", "Aidy", "Ailin", "Aiman", "Ainsley", "Ainslie", "Airen", "Airidas", "Airlie", "AJ", "Ajay", "A-Jay", "Ajayraj", "Akan", "Akram", "Al", "Ala", "Alan", "Alanas", "Alasdair", "Alastair", "Alber", "Albert", "Albie", "Aldred", "Al
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@hyperionstudios
hyperionstudios / HelpersMethods.php
Last active May 22, 2017 01:26
PHP, example of parsing CSV file
<?php
public static function getDataFromCsvFile($csv_file){
$csv = array();
$file = fopen($csv_file, 'r');
while (($result = fgetcsv($file)) !== false){
$csv[] = $result;
}
fclose($file);
return $csv;
}