Skip to content

Instantly share code, notes, and snippets.

View kawsaramin101's full-sized avatar

kawsaramin101

View GitHub Profile
@kawsaramin101
kawsaramin101 / jsonFetch.js
Last active May 12, 2024 06:24
json Fetch.js
async function jsonFetch(url, options) {
if (options.json) {
options.body = JSON.stringify(options.body);
options.headers = {
...options.headers,
"Content-Type": "application/json",
};
delete options.json;
}
return await fetch(url, options);
@kawsaramin101
kawsaramin101 / index.html
Created October 24, 2022 15:47
Poll using html css & javascript
<div class="poll">
<div class="question"></div>
<div class="answers"></div>
</div>
function $(el) {
const type = el.charAt(0);
switch (type) {
case "#":
return document.querySelector(el);
break;
case ".":
return document.querySelectorAll(el);
break;
default:
@kawsaramin101
kawsaramin101 / index.html
Created March 18, 2022 18:28
Toggle (checkbox without label)
<input type="checkbox" class="toggle" checked>
@kawsaramin101
kawsaramin101 / index.html
Created March 18, 2022 18:28
Toggle (checkbox without label)
<input type="checkbox" class="toggle" checked>
@kawsaramin101
kawsaramin101 / jkq.js
Last active May 3, 2022 01:05 — forked from jakerella/jkq.js
An ultra-light, jQuery-like micro-library for selecting DOM elements and manipulating them.
(function() {
'use strict';
/**
* Core method, similar to jQuery (only simpler)
*
* @param {String|HTMLElement} s The CSS selector to search for or HTML element to wrap with functionality
* @param {HTMLElement} root OPTIONAL An HTML element to start the element query from
* @return {Array} The collection of elements, wrapped with functionality (see API methods)
*/