Skip to content

Instantly share code, notes, and snippets.

View lorisleiva's full-sized avatar
Travelling until June 18th. I may be slow to respond.

Loris Leiva lorisleiva

Travelling until June 18th. I may be slow to respond.
View GitHub Profile
lorisleiva / pipeline.js
Last active February 23, 2023 17:28
Laravel-like pipelines in JavaScript and TypeScript
export function pipeline(initialValue, pipes, then) {
then = then ?? ((t) => t);
const pipelineCallback = pipes
.reduce((next, pipe) => (passable) => pipe(passable, next), then);
return pipelineCallback(initialValue);
sindresorhus /
Last active June 16, 2024 19:05
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
GuyARoss / main.js
Created August 9, 2020 08:22
stripe noise thing
import {_ as e, L as t} from "./index-4deec983.js";
import {a as n, C as i} from "./Controller-26bd1e9e.js";
import {S as s} from "./ScrollObserver-d0732a2c.js";
import {F as o} from "./index-bee741e4.js";
class r {
constructor(e, t, n, i=!1) {
const s = this
, o = -1 !=="debug=webgl");
s.canvas = e, = s.canvas.getContext("webgl", {
kieranajp /
Last active June 10, 2020 17:25
An easy way to look at multiple data items in a Kubernetes secret.
#!/usr/bin/env bash
function usage {
echo "An easy way to look at multiple data items in a Kubernetes secret."
echo " Usage: $(basename $0) <secret> <data ...>"
exit 1
if [[ $# -eq 0 ]] ; then
lorisleiva / workflow.yaml
Last active November 18, 2023 04:59
🐳 GitHub Actions using Laravel Docker
name: My Workflow
on: [push]
runs-on: ubuntu-latest
image: lorisleiva/laravel-docker:7.4
- uses: actions/checkout@v2
lorisleiva / ArticleUpdateTest.php
Created August 5, 2019 10:16
✅ Set up traits dynamically for tests
namespace Tests;
use Tests\Authenticated;
use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ArticleUpdateTest extends TestCase
lorisleiva / phpcs.xml
Last active May 4, 2019 14:42
The default PHP Code Style of my Laravel projects.
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Laravel">
<description>The default PHP Code Style of my Laravel projects.</description>
<!-- Files to include. -->
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
repositoriesContributedTo {
PCreations /
Last active January 18, 2024 08:52
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
brunogaspar /
Last active May 1, 2024 07:24
Recursive Laravel Collection Macros


If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.