Skip to content

Instantly share code, notes, and snippets.

View relliv's full-sized avatar
no time for caution

Eyüp relliv

no time for caution
View GitHub Profile

AlpineJS with ViteJS

ViteJS is a modern JavaScript build tool that can be used to build modern JavaScript frameworks including ReactJS and VueJS to name only two. In this tutorial you will explore how to use ViteJS with AlpineJS. This will prepare you for using ViteJS with ReactJS or other modern web framework.

Modern JavaScript built tools like ViteJS, ParcelJS & react-create-app (built with webpack) embrace ES Modules. Meaning that external dependencies are installed via npm and imported. So no more script, style or link tags. HTML, CSS & JavaScript are bundled into compact bundle.

Create app using Vite

Let's start exploring ViteJS by creating a new application. Using this command:

@reanim8ed
reanim8ed / sample.md
Last active January 3, 2024 02:19
[Mailhog in Laragon] #email #laragon #laragon
@tumainimosha
tumainimosha / page-info.ts
Last active July 10, 2024 01:20
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@x-yuri
x-yuri / docker + mongo + mongoid.md
Last active February 20, 2023 12:28
docker + mongo + mongoid
@Supamiu
Supamiu / apollo.interceptor.ts
Created December 9, 2019 13:06
Example interceptor for apollo-angular
import { Injectable } from '@angular/core';
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { filter, switchMap } from 'rxjs/operators';
@Injectable()
export class ApolloInterceptor implements HttpInterceptor {
constructor(private myAuthService: AuthService) {
}
@umutyerebakmaz
umutyerebakmaz / author.entity.ts
Last active April 19, 2023 17:10
TypeORM many to many lazy relation jointable custom table name TypeGraphQL Example (with bi-directional conect GraphQL Approach)
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity, ManyToMany } from 'typeorm';
import { ObjectType, Field, ID, InputType, ArgsType, Int } from 'type-graphql';
import { Book } from '../book/book.entity';
@Entity()
@ObjectType()
export class Author extends BaseEntity {
@PrimaryGeneratedColumn("uuid")
@Field(type => ID)
@mauro-baptista
mauro-baptista / NumberFormat.php
Last active May 8, 2023 00:22
Easily readable numbers
<?php
/**
* Numbers more readable for humans
*
* It intends to change numbers as 1000 as 1K or 1200000 as 1.2M
*
* This code is heavly base in this one: https://gist.github.com/RadGH/84edff0cc81e6326029c
*
* How to use \NumberFormat::readable(1000);
*/
@x-yuri
x-yuri / docker: mongo.md
Last active February 20, 2023 12:28
docker: mongo

Without either MONGO_INITDB_ROOT_USERNAME, or MONGO_INITDB_ROOT_PASSWORD the access is unrestricted.

docker-compose.yml:

version: '3'

services:
  mongo:
    image: mongo:4
@raffis
raffis / php
Created October 8, 2019 07:50
pure md5 algorithm written in php with serialization support
<?php
namespace Hash;
/**
* PHP implementation of the MD5 algorithm according RFC-1321.
* This implementation has support for hash context serialization which the php inbuilt HashContext has not.
*/
class MD5
{
/**
@kctang
kctang / AuthHttpInterceptor.ts
Created January 25, 2019 10:17
AuthHttpInterceptor.ts
import {
HttpEvent, HttpEventType, HttpHandler, HttpInterceptor, HttpRequest
} from '@angular/common/http'
import { Injectable } from '@angular/core'
import { Observable, of } from 'rxjs'
import { concatMap, take } from 'rxjs/operators'
// --- NGXS stuff to read/write access token and refresh token
// --- replace it with your own implementation if you are not using NGXS
import { Select, Store } from '@ngxs/store'
import { AuthState } from '../auth/states/Auth.state'