Skip to content

Instantly share code, notes, and snippets.

View php-cpm's full-sized avatar

zouyi php-cpm

View GitHub Profile
@php-cpm
php-cpm / parse.php
Last active August 25, 2023 10:48
apple iap App Store Server Notifications V2 parse code
<?php
$error = ['code'=>0,'msg'=>''];
$req = json_decode(file_get_contents("php://input"), true);
if (//https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv1
!isset($req['environment']) ||
//https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2
!isset($req['signedPayload']) {
$error = ['code' => 400, 'msg' => 'params error'];
return $error;
}
@thomasdarimont
thomasdarimont / docker-compose.yml
Created January 25, 2019 17:52
Docker OpenLDAP + phpldapadmin example
version: '2'
services:
openldap:
image: osixia/openldap:1.2.3
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "Example Inc."
LDAP_DOMAIN: "example.org"
LDAP_BASE_DN: ""
@laurencei
laurencei / gist:d46893f833d5ddd439eccff025a0b63a
Last active May 7, 2021 16:40
Lumen vs Laravel performance steps
Steps to recreate tests:
// Create and configure server:
1. Create 2GB DigitalOcean server using Forge
2. Enable OpCache on server
3. Create http://domain1.com (use whatever domain name you have available)
4. Create http://domain2.com (use whatever domain name you have available)
5. Enable SSL on both domains using LetsEncrypt
6. Install: sudo apt-get install apache2-utils
@danisfermi
danisfermi / setupdb.md
Created December 15, 2017 23:00
Setup gdb on Mac OS Sierra/High Sierra

Here are the steps to installing and setting up GDB on Mac OS Sierra/High Sierra. Run brew install gdb. On starting gdb, you will get the following error:

Unable to find Mach task port for process-id 2133: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

To fix this error, follow the following steps:

@Mohamed3on
Mohamed3on / The Technical Interview Cheat Sheet.md
Last active April 23, 2020 20:47 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is a fork to fix the markdown errors in the original gist.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@GLMeece
GLMeece / latency_numbers.md
Last active March 1, 2024 10:02
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@yannbertrand
yannbertrand / using_xdebug_with_postman.md
Created December 6, 2016 15:04
Using xDebug with POSTMAN

Set the url with ?XDEBUG_SESSION_START=PHPSTORM and set a header Cookie: XDEBUG_SESSION=PHPSTORM

@Niteshvgupta
Niteshvgupta / readme.md
Last active March 1, 2023 02:15
Install PHP7-compatible memcache on Mac OS X

1. Install PHP7 with brew

brew install php70

2. Install Memcache from source on PHP7 branch

git clone -b NON_BLOCKING_IO_php7 https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache
phpize
./configure
make &amp;&amp; make install
@52cik
52cik / npm.taobao.sh
Last active February 29, 2024 02:56
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
@stevethomas
stevethomas / Myapp.php
Last active September 2, 2020 17:53
Example of how to extend Lumen monolog implementation for New Relic and potentially other handlers
<?php namespace Foo;
// app/Myapp.php
use Monolog\Logger;
use Laravel\Lumen\Application;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\NewRelicHandler;
class Myapp extends Application