Skip to content

Instantly share code, notes, and snippets.

@mwangaben
mwangaben / mariadb-brew-macos.md
Created August 6, 2024 02:08 — forked from nickcernis/mariadb-brew-macos.md
Install MariaDB with brew on macOS and fix the “access denied” issue

Attempting mysql -u root fails with Access denied for user 'root'@'localhost immediately after doing brew install mariadb and starting mariadb with brew services start mariadb.

To fix it (with MariaDB still running):

  1. sudo mysql then enter your Mac user password
  2. ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword'; replacing newrootpassword with the password you wish to use for the MariaDB root user.
  3. Ctrl-C to exit mysql.

You should then be able to connect to MariaDB with mysql -u root -p, then entering the root password when prompted.

@mwangaben
mwangaben / machine.js
Created April 8, 2022 16:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mwangaben
mwangaben / machine.js
Created November 17, 2021 02:24
Generated by XState Viz: https://xstate.js.org/viz
function makeBooking(context, event) {
console.log(event)
let url = `http://localhost:4000/seats/${event.id}`;
let data = {
id: event.id,
number: event.number,
state: 'booked'
}
@mwangaben
mwangaben / machine.js
Last active August 12, 2021 20:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mwangaben
mwangaben / machine.js
Created August 12, 2021 15:33
Generated by XState Viz: https://xstate.js.org/viz
function makeBooking(context, event) {
console.log(event)
let url = `http://localhost:4000/seats/${event.id}`;
let data = {
id: event.id,
number: event.number,
state: 'booked'
}
@mwangaben
mwangaben / machine.js
Last active August 8, 2021 19:58
Generated by XState Viz: https://xstate.js.org/viz
function makeBooking(context, event) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Your Ticket has been booked Successful ')
}, 1000)
})
}
const seatMachine = Machine({
id: 'seat-ticket',
@mwangaben
mwangaben / machine.js
Last active August 7, 2021 15:11
Generated by XState Viz: https://xstate.js.org/viz
// import {createMachine, assign} from 'xstate';
const createUser = function(context, event) {
// alert('Making User');
// console.log(context);
console.log(event.payload);
axios.post('/users', ).then(({data}) => data).catch(error => error);
}
@mwangaben
mwangaben / machine.js
Last active August 7, 2021 11:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mwangaben
mwangaben / paginate.php
Created May 24, 2021 15:56 — forked from vluzrmos/paginate.php
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
<script type="application/ld+json">{
"@context":"http://schema.org",
"@type":"ItemList",
"itemListElement":[
{
"@type": "SiteNavigationElement",
"position": 1,
"name": "Sign Up",
"description": "Create your example profile.",
"url":"https://example.com"