Skip to content

Instantly share code, notes, and snippets.

View KABBOUCHI's full-sized avatar
🎯
Focusing

Georges KABBOUCHI KABBOUCHI

🎯
Focusing
View GitHub Profile
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@jaysson
jaysson / TRPC.ts
Last active March 23, 2024 20:31
TRPC Integration for Adonis
import { initTRPC } from '@trpc/server';
import { resolveHTTPResponse } from '@trpc/server/http';
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
const t = initTRPC.create();
export const appRouter = t.router({
hello: t.procedure.query(() => {
return { message: 'World' };
}),
@mpociot
mpociot / vite.config.js
Last active May 7, 2023 22:11
Using Vite in combination with Valet's secured sites
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import fs from 'fs';
import { resolve } from 'path';
import { homedir } from 'os';
let host = 'sendstack.test';
let homeDir = homedir();
let serverConfig = {};
import path from 'path'
import vue from '@vitejs/plugin-vue'
import icons from 'vite-plugin-svg-icons'
import inspect from 'vite-plugin-inspect'
import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
import createDebugger from 'debug'
import { defineConfig } from 'laravel-vite'
export default defineConfig()
<?php
namespace {{ factoryNamespace }};
use Illuminate\Database\Eloquent\Factories\Factory;
use {{ namespacedModel }};
/**
* @method {{ model }}|\Illuminate\Support\Collection<{{ model }}> create($attributes = [], ?Model $parent = null)
* @method \Illuminate\Support\Collection<{{ model }}> createMany(iterable $records)
@Akryum
Akryum / responsive-menu.html
Created January 6, 2021 15:22
Tailwind negate responsive breakpoints
<div class="flex !md:flex-col items-center !md:space-y-6 md:space-x-6">
<button>Menu button 1</button>
<button>Menu button 2</button>
<button>Menu button 3</button>
</div>
@korakot
korakot / kernel.py
Last active January 19, 2024 06:25
Install rust, cargo in Colab
# run this once, then reload, and then skip this
!apt install rustc
!gdown --id 1PULtTc-2e9z4bswh_SQqL5oy_4JpfV7c
!chmod +x evcxr_jupyter
!./evcxr_jupyter --install
// install dependency
:dep cmd_lib
use cmd_lib::run_cmd as sh;
@IRCSS
IRCSS / SmoothGameCameraMovement.cs
Last active May 10, 2023 03:03
Unity Camera Movement in Game view like Scene View with filtering
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Moves Camera similar to how camera is moved in the Unity view port. Drop the scrip on the game object which has the camera and you wish to move.
public class SmoothGameCameraMovement : MonoBehaviour
{
public float lateralSpeed = 0.0015f;
@simon04
simon04 / git.sh
Created January 14, 2020 07:16
Git merge/replace orphan branch into master
git checkout --orphan new-framework
# completely rewrite your application in new framework
git merge --strategy=ours --allow-unrelated-histories master
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new-framework'" "HEAD^{tree}"
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND
git checkout master
git merge --ff-only new-framework
@wooooodward
wooooodward / axios.js
Created November 6, 2019 17:16
Axios plugin example with request interceptor that adds JWT token to the auth header and 401 response interceptor to refresh token
import Vue from 'vue'
import axios from 'axios'
import store from '../store'
import { TokenService } from '../services/storage.service'
// Full config: https://github.com/axios/axios#request-config
let config = {
baseURL:
process.env.baseURL ||