Skip to content

Instantly share code, notes, and snippets.

View zakariabinsaifullah's full-sized avatar
🎧
Working from home

Zakaria Binsaifullah zakariabinsaifullah

🎧
Working from home
View GitHub Profile
@zakariabinsaifullah
zakariabinsaifullah / type.js
Created July 26, 2024 02:18
Vanilla Js typing effect
<!DOCTYPE html>
<html>
<body>
<h1>Typewriter</h1>
<button onclick="typeWriter()">Click me</button>
<p id="demo"></p>
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.tslint": "explicit",
"source.organizeImports": "explicit"
},
"eslint.run": "onSave",
"emmet.includeLanguages": {
/* eslint-disable camelcase */
/**
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';
import { Fragment, useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
/**
* Components
@zakariabinsaifullah
zakariabinsaifullah / tab-backend.js
Created January 3, 2024 07:51
gutenberg tab script
const { innerBlocks } = useSelect(select => select('core/block-editor').getBlocksByClientId(clientId)[0]);
useEffect(() => {
const { updateBlockAttributes } = dispatch('core/block-editor');
times(innerBlocks.length, n => {
updateBlockAttributes(innerBlocks[n].clientId, {
tabParentId: `${uniqueId}`
});
});
}, [uniqueId, innerBlocks]);
<?php
if (!empty($gfonts)) {
$font_array = explode('|', $gfonts);
foreach ($font_array as $font) {
if (empty($font)) {
continue;
}
$query_args = ['family' => $font];
@zakariabinsaifullah
zakariabinsaifullah / webpack.config.js
Created August 28, 2023 02:22
webpack config for gutenberg block development
const path = require('path');
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const { getWebpackEntryPoints } = require('@wordpress/scripts/utils/config');
module.exports = {
...defaultConfig,
entry: {
...getWebpackEntryPoints(),
'global/global': path.resolve(process.cwd(), 'src', 'global', 'index.js')
},
@zakariabinsaifullah
zakariabinsaifullah / package.json
Created August 7, 2023 18:20
Prettier Config on package.json file
"prettier": {
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 140,
"proseWrap": "preserve",
"quoteProps": "as-needed",
@zakariabinsaifullah
zakariabinsaifullah / docker-compose.yml
Created August 7, 2023 12:43
Setup WordPress local development environment
version: "3.1"
services:
db:
image: mysql:5.7
platform: linux/x86_64
restart: always
environment:
MYSQL_ROOT_PASSWORD: PASSWORD
MYSQL_DATABASE: WORDPRESS
MYSQL_USER: USER
More Triggers: https://tinyurl.com/triggers-cheatsheet
Gist Link: https://tinyurl.com/deploy-general
Gist Link: https://tinyurl.com/deploy-after-build
https://tinyurl.com/asset-readme
https://tinyurl.com/sample-distignore
@zakariabinsaifullah
zakariabinsaifullah / select.js
Created July 25, 2023 17:51
React Select Style with CSS
<Select
classNamePrefix="gkits"
value={{
value: (value || '').replace(/\s+/g, '-'),
label: value,
}}
onChange={onFontChange}
options={fonts}
unstyled={true}
isSearchable={true}