Skip to content

Instantly share code, notes, and snippets.

View gdarko's full-sized avatar
Crunching code, one line at a time.

Darko Gjorgjijoski gdarko

Crunching code, one line at a time.
  • Self-employed
  • The Internet
  • 06:38 (UTC +02:00)
View GitHub Profile
@joepie91
joepie91 / vpn.md
Last active May 20, 2024 03:37
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@pascalpoitras
pascalpoitras / config.md
Last active May 11, 2024 04:13
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active April 22, 2024 17:19
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@vishalbasnet23
vishalbasnet23 / functions.php
Created June 28, 2016 07:51
Create WooCommerce Subscription and activate Subscription for a user programatically.
<?php
function cpm_create_order($customer_data, $the_customer) {
global $woocommerce;
$product_id = $customer_data['sub_product'];
$variation_id = $customer_data['sub_variation'];
$user_first_name = $customer_data['first_name'];
$user_last_name = $customer_data['last_name'];
$user_email = $customer_data['user_email'];
$billing_email = $customer_data['user_email'];
$billing_state = $customer_data['cpm_state'];
@ntwb
ntwb / ExpressionEngine.php
Last active June 29, 2019 11:13 — forked from RickeyMessick/gist:780b857970a4bb72a79f
bbPress- Expression Engine Importer
<?php
/**
* ExpressionEngine converter base impoprter template for bbPress
*
* @since bbPress (rXXXX)
* @link Codex Docs http://codex.bbpress.org/import-forums/expression-engine
*/
class ExpressionEngine extends BBP_Converter_Base {
@kamermans
kamermans / simple_dnsbl.php
Created January 2, 2012 01:32
Simple DNSBL/RBL PHP function - trust me, it's better than checkdnsrr, fsock, socket_create, Net::DNSBL and Net::DNS
<?php
// Simple DNSBL/RBL PHP function - trust me, it's better than checkdnsrr, fsock, socket_create, Net::DNSBL and Net::DNS
// Here's a [better] way to quickly check if an IP is in a DNSBL / RBL. It works on Windows and Linux,
// assuming nslookup is installed. It also supports timeout in seconds.
function ipInDnsBlacklist($ip, $server, $timeout=1) {
$response = array();
$host = implode(".", array_reverse(explode('.', $ip))).'.'.$server.'.';
$cmd = sprintf('nslookup -type=A -timeout=%d %s 2>&1', $timeout, escapeshellarg($host));
@exec($cmd, $response);
@jakubmikita
jakubmikita / Storable.php
Last active February 19, 2019 18:11
WordPress global storage using filter
<?php
/**
* Storable interface
*/
interface Storable extends \ArrayAccess, \Iterator {}
# Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
@alkavan
alkavan / php-7.2-anon-class-vs-array-mem.md
Last active April 10, 2018 22:36
PHP 7.2 Anonymous Class vs Array - Memory Test

PHP 7.2 real app usage:

public function jsonSerialize()
    {
        $m1 = memory_get_usage();
        $json_class = new class implements SpecExportInterface {
            public $id;
            public $status;
            public $code;
            public $title;