Skip to content

Instantly share code, notes, and snippets.

View hassanuos's full-sized avatar
😇
I may be slow to respond.

Hassan Raza hassanuos

😇
I may be slow to respond.
View GitHub Profile
@hassanuos
hassanuos / USA-select-state-list.html
Created February 16, 2021 13:24 — forked from jacurtis/USA-select-state-list.html
A full list of USA states for using in an HTML state dropdown
<select>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
@hassanuos
hassanuos / example.php
Last active March 26, 2021 12:40
simple interview example code
//Write a program that prints the numbers 1 to 100, but for every multiple of 3 write "Fizz",
//for every multiple of 5 write "Buzz", for every multiple of 3 and 5 write "FizzBuzz"
//OutPut
//1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz...
//Code Here Below
$inputVal = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
@hassanuos
hassanuos / filterArray.js
Created April 29, 2021 19:16 — forked from jherax/filterArray.js
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@hassanuos
hassanuos / sqlsrv_test.php
Created May 25, 2021 19:57 — forked from MCF/sqlsrv_test.php
PDO sqlsrv PHP driver, connect and query SQL Server database - reduced test case.
<?php
$serverName = "sqlserver.example.com";
$database = "myDbName";
$uid = 'sqlserver_username';
$pwd = 'password';
try {
$conn = new PDO(
"sqlsrv:server=$serverName;Database=$database",
$uid,
<?php
// Use this class to deserialize error caught
use XeroAPI\XeroPHP\AccountingObjectSerializer;
use XeroAPI\XeroPHP\PayrollAuObjectSerializer;
class ExampleClass
{
public $apiInstance;
function __construct() {
@hassanuos
hassanuos / upgrade-php7.sh
Created June 3, 2021 18:39 — forked from heathdutton/upgrade-php7.sh
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5
#
# Must be ran as sudo:
# sudo bash upgrade-php7.sh
#
# Can be added to ./.ebextensions/20_php.config like so:
# container_commands:
@hassanuos
hassanuos / auth.php
Created June 21, 2021 13:18 — forked from jcbagtas/auth.php
Get current Laravel active session from outside laravel instance. Laravel 5.2
<?php
/**
* Get current Laravel active session from outside laravel instance.
* Tested Laravel 5.2
*
*
*/
function getLaravelUser()
{
require __DIR__ . '\path\to\bootstrap\autoload.php';
abuse
admin
all
billing
contact
everyone
ftp
jobs
list
marketing
@hassanuos
hassanuos / LaravelCookieDecrypter.php
Created June 22, 2021 08:42 — forked from glennkarlsen/LaravelCookieDecrypter.php
Decrypt laravel_session outside of the Laravel app. This is just a proof of concept, cleanup and extend to your needs.
<?php
class LaravelCookieDecrypter {
/**
* The encryption key.
*
* @var string
*/
protected $key = 'YOUR LARAVEL .ENV APP KEY';
@hassanuos
hassanuos / SessionShiftingLaravel.php
Last active June 23, 2021 10:29
Laravel 7.3 Session Access Outside Laravel 7.3 Directory
// I have one native php project and i want to shift session from Laravel 7.3 to Native old PHP 5.6 and i found this method Its working example
// Please replace your cookie name here below in the code YOUR_LARAVEL_COOKIE_ID `line 16`.
// Also please change the $base64_key get it from your laravel .env file line 14.
// `user` thats my custom session key on laravel and i get all the data line 28.
try {
require_once($_SERVER['DOCUMENT_ROOT'] . "/site/home/vendor/autoload.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/site/home/bootstrap/app.php");
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');