Skip to content

Instantly share code, notes, and snippets.

View alalfakawma's full-sized avatar
🖱️

Aseem Lalfakawma alalfakawma

🖱️
View GitHub Profile
@alalfakawma
alalfakawma / useCrud.js
Last active March 27, 2024 08:35
Quasar Vue3 useCrud composeable (with Laravel Pagination)
import { axios } from 'src/boot/axios'
import { ref, onMounted, watch } from 'vue'
import { useQuasar } from 'quasar'
import usePagination from './custom-pagination'
export default function useCrud ({ name, paginated = true, fetchWhenMounted = true }) {
const currentPage = ref(1)
const data = ref([])
const { pagination, paginate } = usePagination(currentPage)
@alalfakawma
alalfakawma / ImageConversionService.php
Created March 25, 2023 13:04
Convert image to webp for storage [Laravel]
<?php
// NOTE: This service uses Intervention Image, which will require you
// to have Imagick or GD php extension to work
namespace App\Services;
use App\Models\Image as ImageModel;
use Illuminate\Support\Facades\File;
use Intervention\Image\Facades\Image;
/*
* Check keys of objects
* return false if atleast 1 key does not match
* return true if all keys are the same
*
* @param key Array<string> | string
* @param obj1 { [key: string]: string }
* @param obj2 { [key: string]: string }
* @return boolean
*/
@alalfakawma
alalfakawma / footeratfoot.md
Last active December 14, 2018 10:58
Footer at the foot

Footer at the foot

Here is a link of an example on codepen - Footer at the foot


As you're developing a site, you will come across a time when you have small amount of content on your page but you want a footer at the bottom, seems easy right? Just have position: fixed; bottom: 0;, right? But that would make the footer stick to the bottom, even when you scroll, wait, we said that the content will not fill up the page anyway, so why is this not the solution? We won't normally have a problem if this was on a single page site but when it comes to multiple pages the footer will still be on the bottom obscuring some content whilst the user scrolls the page which would be, gawd, awful ux! This could be handled with some javascript too, but using javascript should be our last option, if we can fix it something with a hammer, we should fix it with hammer, no need to use a nailgun. In order to do this, we would need 3 divs in a container.

    <div
@alalfakawma
alalfakawma / Typer.js
Last active December 18, 2018 17:21
Animated Typer component for React
/*
Author: Aseem Lalfakawma<https://github.com/alalfakawma>
This component has 4 props -
- text: The text you want to have a typing animation (Default: 'This is a blinker component')
- textClass: Add class to text (Default: null)
- cursorBlinkSpeed: Cursor's blink speed in ms (Default: 500)
- typeSpeed: Speed of the typing (Default: 250)
- cursorClass: Add class to cursor (Default: null)
*/
@alalfakawma
alalfakawma / helper.scss
Last active January 30, 2021 14:42
Bulma SCSS Table column width helper
/*
Author: Aseem Lalfakawma <alalfakawma.github.io>
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
The Bulma framework does not support this yet, this small code snippet fixes this.
USAGE:
* Should be applied on TH element, it controls all the columns under it *
The class should be "is-#",
is-1 will give the first widthamount, is-2 will give the second.
Eg. The code below shows the widthAmounts as (1, 2.5, 3, 4 , 5, 6, 7)