Skip to content

Instantly share code, notes, and snippets.

View MillerAdulu's full-sized avatar
💭
I will be slow to respond.

Miller Adulu MillerAdulu

💭
I will be slow to respond.
View GitHub Profile
on:
pull_request:
types: [closed]
branches:
- master
jobs:
docker:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
@MillerAdulu
MillerAdulu / chunk_list_sample.dart
Created October 16, 2021 13:39 — forked from jorwan/chunk_list_sample.dart
Extension to chunk list
void main() => print(List.generate(10, (i) => i).chunk(3));
extension ListChunkerExtension on List {
List chunk(int chunkLength) {
if ((chunkLength ?? 0) <= 0 || (this ?? []).length == 0)
return this;
var chunks = [];
for (var i = 0; i < this.length; i += chunkLength) {
chunks.add(this.sublist(
i, i + chunkLength > this.length ? this.length : i + chunkLength));
@MillerAdulu
MillerAdulu / pivot-tables.md
Created March 24, 2021 14:39 — forked from Braunson/pivot-tables.md
Laravel 8.x - Diving into Pivot Tables

Laravel 6 - Diving Into Pivot Tables

Pivot tables can be confusing and a little hard to wrap your head around at first. In this quick article we are going to dive into what a pivot table is, how to create one and finally how to use the pivot table. Let's dive in!

What is a pivot table?

A pivot table is used to connect relationships between two tables. Laravel provides a Many To Many relationship where you can use a pivot table.

@MillerAdulu
MillerAdulu / digitalocean.md
Created October 27, 2020 16:38 — forked from cole007/digitalocean.md
Digital Ocean internal migration - moving files between droplets over SSH/SCP

If you need to move a lot of files between DO server you can move these through SCP over the internal private Digital Ocean network.

NB both droplets need to be within the same region

To do this you need:

  1. enable private network for each droplet (if not done at creation, note the droplet needs to be off for this to be enabled once live)
  2. ensure that eth1 is enabled for both droplets if not already - see https://www.digitalocean.com/community/tutorials/how-to-enable-digitalocean-private-networking-on-existing-droplets
  3. scp files from the source server to the destination server are sent like:
@MillerAdulu
MillerAdulu / shopping_cart.dart
Last active July 10, 2020 10:12 — forked from simolus3/shopping_cart.dart
Shopping carts in moor
import 'package:moor/moor.dart';
import 'package:rxdart/rxdart.dart';
part 'shopping_cart.g.dart';
class ShoppingCarts extends Table {
IntColumn get id => integer().autoIncrement()();
}
class BuyableItems extends Table {