Skip to content

Instantly share code, notes, and snippets.

View RickardAhlstedt's full-sized avatar

Rickard Ahlstedt RickardAhlstedt

View GitHub Profile
<?php
class Registry {
/**
* @var array The store for all objects
*/
static private $store = array();
/**
@micc83
micc83 / mysqldump.php
Created June 5, 2017 13:17
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
@cybersamx
cybersamx / ssh-key-generation.md
Last active June 15, 2024 08:26
Generate a new SSH key pair

Mac and Linux

  • Open Terminal

  • Check if you already have a SSH keypair generated. Do the following:

    $ ls -la ~/.ssh/id_rsa*
    

If the files exist, you already have SSH installed. IMPORTANT: But if you wish to regenerate the SSH key pair, at least back up your old SSH keys.

@HonzaMac
HonzaMac / retry.php
Created November 6, 2015 22:44
Retry any function in php
<?php
if (!function_exists('retry')) {
/**
* Retries callable
*
* Could be specified how many times, default is 1 times.
*
* @param callable $what
* @param int $retry how many time should it be retried, default is 1
* @return mixed
@maxim
maxim / gh-dl-release
Last active April 18, 2025 11:37
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@j3j5
j3j5 / gist:8b3e48ccad746b90a54a
Last active November 16, 2023 15:11
Adyen Test Card Numbers
Adyen Test Card Numbers
These cards are only valid on our TEST system and they will never involve any actual transaction or transfer of funds. The TEST card numbers will not work on the Adyen LIVE Platform.
For all cards use the following expiration and CVV2/CVC2/or CID for Amex.
For all cards:
Expiration Dates CVV2 / CVC3 CID (American Express)
08/2018 OR 10/2020 737 7373
@dukeofharen
dukeofharen / gist:e2c60b4478408b53d743
Last active June 18, 2023 19:20
WordPress like shortcode parser for PHP
<?php
//The content which should be parsed
$content = '<p>Hello, my name is John an my age is [calc-age day="4" month="10" year="1991"].</p>';
$content .= '<p>Hello, my name is Carol an my age is [calc-age day="26" month="11" year="1996"].</p>';
//The array with all the shortcode handlers. This is just a regular associative array with anonymous functions as values. A very cool new feature in PHP, just like callbacks in JavaScript or delegates in C#.
$shortcodes = array(
"calc-age" => function($data){
$content = "";
//Calculate the age
@rodro12
rodro12 / containerBridge.php
Created February 7, 2013 10:30
containerBridge
<?php
/**
* ContainerBridge.php
*
* Copyright © 2005-2006, FileMaker, Inc. All rights reserved.
* NOTE: Use of this source code is subject to the terms of the FileMaker
* Software License which accompanies the code. Your use of this source code
* signifies your agreement to such license terms and conditions. Except as
* expressly granted in the Software License, no other copyright, patent, or
* other intellectual property license or right is granted, either expressly or