Skip to content

Instantly share code, notes, and snippets.

View MubinSayed's full-sized avatar
🎯
Focusing

Mubin Sayed MubinSayed

🎯
Focusing
View GitHub Profile
@MubinSayed
MubinSayed / save_to_csv.php
Created May 7, 2021 00:38 — forked from dertajora/save_to_csv.php
This script is used to generate CSV file and save it to specific folder, I implement it on Codeigniter. Please modify the location of APPPATH section if you want to save to another location
<?php
// this script would save csv file to this specified directory
// APPPATH is location of application folder in Codeigniter
$file = fopen(APPPATH . '/../upload/'.'tesaasasat.csv', 'wb');
// set the column headers
fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5'));
// Sample data. This can be fetched from mysql too
$data = array(
@MubinSayed
MubinSayed / console.php
Created April 1, 2021 11:23 — forked from meigwilym/console.php
Laravel Create User Command
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([
@MubinSayed
MubinSayed / IndianStatesDistricts.json
Created March 28, 2021 08:52 — forked from Dhaneshmonds/IndianStatesDistricts.json
Indian states, capitals and districts
{
"states": [
{
"id": "1",
"type": "Union Territory",
"capital": "Mayabunder",
"code": "AN",
"name": "Andaman and Nicobar Islands",
"districts": [
{
@MubinSayed
MubinSayed / covertToHierarchy.php
Created April 12, 2019 12:32 — forked from ubermaniac/covertToHierarchy.php
Convert a DB result of parent/child items into a hierarchical array
<?php
// -- Only one caveat : The results must be ordered so that an item's parent will be processed first.
// -- Simulate a DB result
$results = array();
$results[] = array('id' => 'a', 'parent' => '', 'name' => 'Johnny');
$results[] = array('id' => 'b', 'parent' => 'a', 'name' => 'Bobby');
$results[] = array('id' => 'c', 'parent' => 'b', 'name' => 'Marky');
$results[] = array('id' => 'd', 'parent' => 'a', 'name' => 'Ricky');