Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@holisticnetworking
holisticnetworking / autoload.php
Created January 13, 2018 02:34
Autoloading for both WordPress classes and PSR2 files in a /vendor directory.
<?php
/**
* PSR4 autoloader using spl_autoload_register
* @package HN_Reactive
* @author Thomas J Belknap <tbelknap@holisticnetworking.net>
*/
namespace HN_Reactive;
spl_autoload_register( function ( $class ) {
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@glueckpress
glueckpress / wp-rocket-example-deactivate-for-amp.php
Last active March 5, 2019 21:15
[WordPress][WP Rocket]Disable all WP Rocket functions on AMP pages created by the Automattic AMP plugin.
<?php
/**
* UNTESTED EXAMPLE!
* Please don’t use in production without having tested it before!
* @link http://wordpress.stackexchange.com/a/12165
* @return void
*/
function example__disable_rocket_cache_for_amp_pages() {
if ( ! defined( 'AMP_QUERY_VAR' ) )
return;
@igorbenic
igorbenic / gateway.php
Last active February 21, 2024 21:32
How to create a custom WooCommerce Payment Gateway
<?php
// ...
function woo_payment_gateway() {
class Woo_PayPal_Gateway extends WC_Payment_Gateway {
}
}
@nkt
nkt / Results.md
Last active September 27, 2023 08:24
ReactPHP vs Node.js

wrk -t4 -c400 -d10s http://127.0.0.1:1337/

PHP

Running 10s test @ http://127.0.0.1:1337/
  4 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
 Latency 7.02ms 6.94ms 82.86ms 85.27%
@spekkionu
spekkionu / composer.json
Created October 9, 2014 20:07
Standalone validation using laravel validation component
{
"name": "spakkionu/validate",
"description": "Validation Test",
"require": {
"illuminate/validation": "~4.2.9"
},
"license": "MIT",
"authors": [
{
"name": "Jonathan Bernardi",
@mrowe
mrowe / skeleton
Created July 16, 2014 06:55
init.d skeleton
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
http://sugg.search.yahoo.net/sg/?output=jsonp&nresults=10&command=django
http://sugg.search.yahoo.net/sg/?output=json&nresults=10&command=django
http://sugg.search.yahoo.net/sg/?output=xml&nresults=10&command=django