Skip to content

Instantly share code, notes, and snippets.

View eskayamadeus's full-sized avatar
🖥️
Tinkering.

Elikem Seake-Kwawu eskayamadeus

🖥️
Tinkering.
View GitHub Profile
@eskayamadeus
eskayamadeus / install latest node and npm on ubuntu
Created December 30, 2024 13:32
install latest node and npm on ubuntu
To install the latest Node.js and npm on Ubuntu, follow these steps:
Update your package list:
sudo apt update
Install Node.js using NodeSource:
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
Verify the installation:
@eskayamadeus
eskayamadeus / method_chaining_in_js.js
Created June 27, 2023 22:07
How to perform method chaining in JS
// Source: https://www.typescriptlang.org/play?target=1&ssl=42&ssc=3&pln=21&pc=1&q=316#code/PTAEDEFcDsGMBcCWB7apYAsCGjq4OagCCACgJIDOoWATgKbXrIC2zqoADlvPHTWrgBQIUACksANywBlWDUQd4AGlAB3DIkzosaZlgDWDAJ7JINJgBMGAM2SxIFOheFhVieBlAAbOhSq5eGmYnRFojUCkvSF9qaAtQOiwKRD5QeGRQeixnEQAjOlgsBwZkazSMOkRzaF8kaEIAR0gsL3cUigA6QRdiTMSvL3DYFjY0UjI1DS1VZBp9KglQ9GxcAh7EKgArAEVomiMO0AAJPgYN2ISADyxmDh9QUtAdvaMe-IJQYvi3D3KGeCMHBi1hoLFAABE6NZVrxBgAVQFOABc3UQt1m8FAABJQCCwQAiTZNPhGfEAbm6IhO9AA5FQdFcbncGMUHmUPAxniTiOQUYIsQAKfEAYmgkkQ+G4KGg+IAlB1YH4hbksLB9PhQTALPiVPj6Nr5RUJRh4AKAMwABgt8us2ToZGgAoATFbZRSemQyiZINQLPEsKALMhMewOd5cAwsLlkBI6CpvTSBqBHHQegGvKhCK0KCGytYYAhpZ1QHCNFQuDw+AIqIkKOF0j16BxQRZILAzmhxFJZPJFIdSwxDOFzulQHpDMmzKmRN7qF5VFgjFR6PAzGgwxQbiVcpsCvAuj1qWd6Wg6NdbvdxpNNJ45IlePTljg8PUeuN+xVQEPQCOMthYxcpiBLiBZIOw6g3j0hh0BwVDwDQqr6GyP7QIEYpeMm8DcHGsT+mgyA7nu16YD0Z4cMgjhwZ+V4eNwP70vOi7LnQq78E4B7DNAOa+hYcIzAAcpAzD5DQVAALygAKOa0JiEkAIyyqAYkAHygAA3oIoDeCxoBoBJ0k0PA7paZx3FYBwiBKepmlaaAIhkBedDBKhCSqp4+ZwGBAhoN65jjDZWnZBYAq4LASK6UJIlWQp1m2bZaAA
@eskayamadeus
eskayamadeus / post-install-instructions-for-mysql-8-in-laragon
Created September 15, 2022 11:13
I had an issue where I had installed a new version of mysql, namely 8.0.30, in Laragon using the .zip community version. But then I couldn't do anything because it was throwing "access denied for root@localhost"
1. Go to C:\laragon\bin\mysql\mysql-8.0.30-winx64
2. Execute bin\mysqld.exe --initialize-insecure --console
[
initialize-insecure => creates root user without password
console => outputs information to current terminal. without it, they may end up in mysqld.log
]
@eskayamadeus
eskayamadeus / spatie-skeleton-configure.php
Created October 11, 2021 16:21
Configuration file for Spatie Laravel Skeleton - PHP 7
#!/usr/bin/env php
<?php
function ask(string $question, string $default = ''): string {
$answer = readline($question . ($default ? " ({$default})" : null) . ': ');
if (! $answer) {
return $default;
}
@eskayamadeus
eskayamadeus / pdo_fetch_types.php
Created May 13, 2021 12:51
A brief description of various ways one can fetch data in PHP using PDO
<?php
include_once('../../db.php');
// SET 1
$sql = 'SELECT * FROM users';
$stmt = $userConn->query($sql);
$users = $stmt->fetch(); // by default, the argument in the bracket is PDO:FETCH_BOTH
echo '<pre>',print_r($users),'</pre>';
@eskayamadeus
eskayamadeus / pdo_examples.php
Created February 16, 2021 21:06 — forked from cp6/pdo_examples.php
PHP PDO MySQL cheat sheet
<?php
//Create connection
$db = new PDO('mysql:host=localhost;dbname=DATABASENAME;charset=utf8mb4', 'USERNAME', 'PASSWORD');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//https://www.php.net/manual/en/pdo.setattribute.php
//Check connection status
echo $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
//SELECT with loop
$select = $db->prepare("SELECT `col`, `col2` FROM `table`");
@eskayamadeus
eskayamadeus / pdocrash.php
Created February 16, 2021 20:57 — 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