Skip to content

Instantly share code, notes, and snippets.

View phpfour's full-sized avatar

Mohammad Emran phpfour

View GitHub Profile
@phpfour
phpfour / HttpUtility.php
Created September 9, 2019 14:17
HttpUtility
<?php
namespace Vroom\Notification\Utility;
final class HttpUtility
{
public static function requestAsync($url, $params = [], $headers = [], $method = 'POST', $timeout = 30)
{
$paramString = http_build_query($params);
@phpfour
phpfour / serializer.php
Last active November 29, 2018 11:37
JMS Serializer Options
<?php
use JMS\Serializer\SerializerBuilder;
use JMS\Serializer\JsonSerializationVisitor;
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
$visitor = new JsonSerializationVisitor(
new SerializedNameAnnotationStrategy(
new IdenticalPropertyNamingStrategy()
@phpfour
phpfour / debug.php
Created October 1, 2018 10:55
Debug Incoming HTTP Requests
<?php
function debugHttpRequest($filename, $mode = FILE_APPEND, $json = false)
{
$output = '[' . date('Y-m-d H:i:s') . '] '
. $_SERVER['REQUEST_METHOD'] . ' '
. $_SERVER['REQUEST_URI']
. "\n\n";
foreach ($_SERVER as $key => $value) {
@phpfour
phpfour / wp-user.md
Last active March 9, 2018 14:25
WP New Admin User

Running the below queries will create a new admin user in Wordpress:

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('emran', MD5('emran123'), 'Mohammad Emran', 'phpfour@gmail.com', '0');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
@phpfour
phpfour / macosx-install-php-oracle-oci8-pdo_oci.md
Created October 14, 2017 10:44 — forked from fhferreira/macosx-install-php-oracle-oci8-pdo_oci.md
Install OCI8 and / or PDO_OCI on OSX via Brew

Installation

This procedure is tested on Mac OS X 10.10.5 with Developpers tools installed (xCode).

PHP 5.6 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

<?php
namespace AppBundle\EventListener;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events;
use Doctrine\Common\EventSubscriber;
/**
* Changes Doctrine's default Oracle-specific column type mapping to Doctrine
@phpfour
phpfour / deploy.php
Created August 15, 2017 06:12
Simple Laravel Deployment with Release Notes as Slack notification
<?php
// See: https://github.com/foodkit/jira-release-notes
// See: https://github.com/foodkit/laravel-deployer
namespace Deployer;
require __DIR__.'/vendor/foodkit/laravel-deployer/src/laravel-norevision.php';
use Symfony\Component\Console\Input\InputOption;
@phpfour
phpfour / gist:00b62511c0dc6f9ea36b2c0d98dfa5ed
Created July 21, 2017 15:48 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@phpfour
phpfour / a-new-mac-setup.md
Created June 25, 2017 18:08 — forked from maxfenton/a-new-mac-setup.md
System setup stuff for a new mac

New computer setup

  • a/o 2016-05-21 *

--

Format the drive

  1. Restart with Cmd-R or Cmd-D
  2. Erase drive / 3x if second-hand
  3. Reinstall MacOS
5 words in english:
Surrender
Submission
Obedience
Sincerity
Peace