Skip to content

Instantly share code, notes, and snippets.

View nellytadi's full-sized avatar

Nelly nellytadi

View GitHub Profile
<?php
function getStatistics() {
$data = [];
$data['users'] = [];
// 65k rows
$allTptp = TariffProviderTariffMatch::all();
foreach ($allTptp->groupBy('user_id') as $each) {
$one = [];
$one['name'] = $each[0]->user->first_name . " " . $each[0]->user->last_name;
$one['valid'] = 0;
<?php
$email='john@example.com';
public function validate($email)
{
// Initialize CURL:
$ch = curl_init('http://apilayer.net/api/check?access_key='.$access_key.'&email='.$email.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
<?php
public function degrees($hour, $min)
{
$degree = $hour*30 + $min *6;
if ($degree>360){
$result= $degree - 360;
}
elseif ($degree< 360) {
$result = $degree;
}
@nellytadi
nellytadi / test.php
Last active November 27, 2019 10:39
Merge two array and give them new keys
<?php
public function test(){
$array =[0=> [ "organisation_name" => "HERTFORDSHIRE LIMITED",
"company_number" => "06124924",
"address" => " Schopwick Place, High Street, Elstree, Hertfordshire, England, WD6 3SW",
"company_status" => "active",
"company_type" => "ltd",
"date_of_incorporation" => "2007-02-23",
"nature_of_business" => "70100",
"town" => "Elstree"]];
@nellytadi
nellytadi / Nelly Tadi Curriculum Vitae
Created December 6, 2019 11:57
Nelly Tadi's Curriculum Vitae
# Tadi Nelly Habiba
Address: C21 Army Post Housing Estate, Kurudu, Abuja
Email: **nellytadi@gmail.com**** |** Telephone: 081 6363 8322
| PERSONAL PROFILE | |
| --- | --- |
@nellytadi
nellytadi / manual_paginate.php
Last active April 13, 2023 15:12
Manual Paginate In Laravel
<?php
namespace App\Http\Controllers\Api;
use App\Model;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
@nellytadi
nellytadi / findHighestReoccuringNumber.php
Last active February 13, 2021 16:44
This is an algorithm written in PHP for finding the most-repeated number in an array of numbers.
<?php
function inEfficientFindHighestReOccurringNumber($array){
$highest_reoccuring_number = 0;
$prevcount = 0;
for ($i = 0; $i < count($array); $i++){
$count = 0;
for ($y = 0; $y < count($array); $y++){