Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
AnthoniG / INSTALLATION.md
Created May 25, 2019 15:25 — forked from DenisIzmaylov/INSTALLATION.md
DigitalOcean Dokku: fresh install with Node.js Environment

DigitalOcean Dokku / Node.js Cloud Environment

Custom recipe to get full Node.js Cloud Environment in DigitalOcean Dokku droplet running from scratch. Yes. Your own Heroku for $5 per month.

I use this gist to keep track of the important configuration steps required to have a functioning system after fresh install.

When you have executed that's all step by step you will get a new working and stable system which is ready to host & serve your Node.js application and databases.

@AnthoniG
AnthoniG / notes.md
Created June 14, 2019 18:42 — forked from matthewjberger/notes.md
How to make an electron app using Create-React-App and Electron with Electron-Builder.
@AnthoniG
AnthoniG / change-favicon.js
Created January 11, 2020 09:56 — forked from mathiasbynens/change-favicon.js
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
@AnthoniG
AnthoniG / dark_fusion.py
Created September 11, 2020 04:02
Qt5 Dark Fusion Palette for Python
qApp.setStyle("Fusion")
dark_palette = QPalette()
dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
dark_palette.setColor(QPalette.WindowText, Qt.white)
dark_palette.setColor(QPalette.Base, QColor(25, 25, 25))
dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
dark_palette.setColor(QPalette.ToolTipText, Qt.white)
@AnthoniG
AnthoniG / pdocrash.php
Created November 16, 2020 09:18 — forked from bradtraversy/pdocrash.php
PDO & Prepared Statements Snippets
<?php
$host = 'localhost';
$user = 'root';
$password = '123456';
$dbname = 'pdoposts';
// Set DSN
$dsn = 'mysql:host='. $host .';dbname='. $dbname;
// Create a PDO instance
@AnthoniG
AnthoniG / pdo_db.php
Created November 16, 2020 12:51 — forked from bradtraversy/pdo_db.php
PDO Class
<?php
/*
* PDO DATABASE CLASS
* Connects Database Using PDO
* Creates Prepeared Statements
* Binds params to values
* Returns rows and results
*/
class Database {
private $host = DB_HOST;
@AnthoniG
AnthoniG / php.ini
Created November 30, 2020 06:26 — forked from tomasfejfar/php.ini
Settings to copy to your php.ini to make debugger work. It lists many unnecessary values just in case they were overridden before.
; path to your php_xdebug extension file
; download from https://xdebug.org/wizard.php
zend_extension="c:\xampp-php7\php\ext\php_xdebug-2.4.0-7.0-vc14.dll"
; disables profiler globally
xdebug.profiler_enable = 0
; allows enabling it selectively with request parameter "XDEBUG_PROFILE"
xdebug.profiler_enable_trigger = 1
; directory to output profiler files to
xdebug.profiler_output_dir = "C:\xampp-php7\tmp"
; profiler file name (with request uri and timestamp)
@AnthoniG
AnthoniG / curl_test.php
Created December 14, 2020 16:09
Testing various curl functions for async
function make_request($url, $waitResult=true){
$cmi = curl_multi_init();
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle($cmi, $curl);
$running = null;
@AnthoniG
AnthoniG / myscript.sh
Created December 17, 2020 13:18 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@AnthoniG
AnthoniG / types.ts
Created January 14, 2021 14:43 — forked from ClickerMonkey/types.ts
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]