Skip to content

Instantly share code, notes, and snippets.

@r3sult
r3sult / bootstrap.php
Created November 2, 2019 22:00 — forked from joseluisq/bootstrap.php
Composer project to generate PHP Doctrine 2 models from database
<?php
// bootstrap.php
// Include Composer Autoload (relative to project root).
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
date_default_timezone_set('America/Lima');
require_once "vendor/autoload.php";
<?php
/**
* @author Esser Jan
* @license MIT
* @example InternationalBankAccountNumber::createFromString($someString)
* @example InternationalBankAccountNumber::createFromString($someString)->toFormattedString() // space separated
* @example InternationalBankAccountNumber::createFromString($someString)->toFormattedString('-', 4, true) // IBAN prefixed - separated
*/
class InternationalBankAccountNumber
{
@r3sult
r3sult / emoji.php
Created July 24, 2019 21:38 — forked from battis/emoji.php
Trying to store/retrieve/display Unicode emoji in a MySQL database
<?php
// MySQL schema
/*
CREATE TABLE `test` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`text` text,
`blob` blob,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
<?php
$data = (object)array(
"html" => "<foo bar=\"baz\"/> &amp;",
"arabic" => "العربية al-ʿarabiyyah, IPA: [æl ʕɑrɑˈbijjɐ], or عربي ʿarabī",
"hebrew" => "עִבְרִית, Ivrit",
"chinese" => "汉语/漢語 Hanyu; 华语/華語 Huáyǔ; 中文 Zhōngwén",
"korean" => "한국어/조선말",
"japanese" => "日本語 Nihongo",
"umlauts" => "äüöãáàß",
@r3sult
r3sult / s3-upload-via-link.php
Created July 24, 2019 16:37 — forked from keithweaver/s3-upload-via-link.php
Upload image using link to AWS S3 with PHP
@r3sult
r3sult / s3-upload-via-form.php
Created July 24, 2019 16:37 — forked from keithweaver/s3-upload-via-form.php
Upload image using form submission to AWS S3 with PHP
<?php
// This file demonstrates file upload to an S3 bucket. This is for using file upload via a
// file compared to just having the link. If you are doing it via link, refer to this:
// https://gist.github.com/keithweaver/08c1ab13b0cc47d0b8528f4bc318b49a
//
// You must setup your bucket to have the proper permissions. To learn how to do this
// refer to:
// https://github.com/keithweaver/python-aws-s3
// https://www.youtube.com/watch?v=v33Kl-Kx30o
@r3sult
r3sult / electron-protocol-registration.js
Created June 11, 2019 20:52 — forked from LucaBlackDragon/electron-protocol-registration.js
Start Electron application through registered protocol/app schema (e.g. "my-app://some/thing?param=2")
import { app } from 'electron';
/**
* Startup protocol/app schema registration
*
* @param {string} protocol Startup protocol/app schema to register ("://" must not be included)
*
* process.argv[1] will contain the full protocol/app schema through which the app has been started;
* data can be sent to renderer windows through webContents.send() and ipcRenderer or other means.
*
@r3sult
r3sult / instal_bch_node.md
Created March 28, 2019 09:43 — forked from cgcardona/steps.md
Steps for running a Bitcoin Cash (ABC) node on digital ocean. Forked from these steps: https://medium.com/signal-chain-weekly/how-im-running-a-bitcoin-full-node-on-digital-ocean-for-40-a-month-dfc328ba9604

Setup

  1. Ubuntu 16.04.3 x64
  2. 2 GB Memory / 60 GB Disk
  3. 200 GB block storage volume

Create user

get ip-address from digital ocean

@r3sult
r3sult / QRLogo.php
Created March 1, 2019 11:34 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;
@r3sult
r3sult / gist:6f09a118113caa73e836339f4afe6623
Created February 6, 2019 02:39 — forked from johanmeiring/gist:3002458
"git lg" alias for pretty git log
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"