Skip to content

Instantly share code, notes, and snippets.

View devzakir's full-sized avatar
🏠
Building @JuggleHire for busy recruiters

Zakir Hossen devzakir

🏠
Building @JuggleHire for busy recruiters
View GitHub Profile
@devzakir
devzakir / picker.php
Created May 16, 2022 01:58
PHP Color Lighten and darken
// `adjustBrightness2` works better and `adjustBrightness` works too!
function adjustBrightness($hex, $steps)
{
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps));
// Normalize into a six character long hex string
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
@devzakir
devzakir / vanilla-javascript-open-close-modal.js
Created March 23, 2022 13:59
Open and Close Modal Vanilla JS
// Example
const button = document.querySelector('#showHiddenMenuTwo')
const box = document.querySelector('#hiddenWidgetTwo');
const toggle = event => {
event.stopPropagation();
if (!event.target.closest('#hiddenWidgetTwo')) {
// box.classList.toggle('active');
@devzakir
devzakir / products.csv
Created February 28, 2022 06:48
Shopify Products CSV File
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 44 columns, instead of 3 in line 1.
Handle,Title,Body,Vendor,Type,Tags,Published,Option1 name,Option1 value,Option2 name,Option2 value,Option3 name,Option3 value,Variant sku,Variant grams,Variant inventory tracker,Variant inventory policy,Variant inventory quantity,Variant fullfilment service,Variant price,Variant compare at price,Variant requires shipping,Variant taxable,Variant barcode,Image src,Image alt text,Gift card,Google shopping mpn,Google shopping age group,Google shopping gender,Google shopping google product category,Seo title,Seo description,Google shopping adwords grouping,Google shopping adwords labels,Google shopping condition,Google shopping custom product,Google shopping custom label 0,Google shopping custom label 1,Google shopping custom label 2,Google shopping custom label 3,Google shopping custom label 4,Variant image,Variant weight unit
fantastic-bronze-lamp,Fantastic Bronze Lamp,Typewriter health shabby chic meh street hoodie 3 wolf moon pbr&b literally. Thank You And Goodnight. Shunned immemorial foetid iridescence spect
@devzakir
devzakir / schema.graphql.js
Created February 12, 2022 12:25 — forked from jgthms/schema.graphql.js
Strapi GraphQL find single item by slug
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
query: `
categoryBySlug(slug: String!): Category
`,
resolver: {
Query: {
categoryBySlug: {
resolverOf: 'Category.findOne',
@devzakir
devzakir / Customer support.html
Created February 3, 2022 09:42
Templatecookie Customer Support
<div style="text-align:center">
<a href="https://support.templatecookie.com/" target="_blank">
<img src="https://i.ibb.co/4fbd4yn/Customer-Support.png" alt="Customer-Support" border="0" />
</a>
</div>
@devzakir
devzakir / button.html
Created January 9, 2022 07:18
Templatecookie purchase button
<!-- HTML -->
<div class="templatecookie-btn">
<a href="#" class="purchase-btn">
Purchase Now
<span>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
</span>
</a>
@devzakir
devzakir / bash.md
Last active December 16, 2021 15:32
Branch & Pull Requests

Please commit your changes before changing branch

For the first you have to create live branch if you don't have live branch on your repo git checkout -b live

Branch is available on github repo but not in your computer

git fetch origin

# create a new branch from existing branch
@devzakir
devzakir / docs.md
Last active January 27, 2022 07:02
Managing multiple GitHub Deploy Keys on a single server

GitHub allows you to attach a deploy key to any of your repositories. However, each repo must have its own unique key. If you’re deploying multiple GitHub repos on a single machine, that means you’ll need to set up multiple ssh keys for that machine. The easiest way to achieve this is to leverage ssh’s host config. If you have mygithubuser/repo1 and mygithubuser/repo2 that you want to deploy on a single machine, first create an rsa key pair for each repo:

ssh-keygen -t rsa -f ~/.ssh/repo1_rsa -C "repo1 deploy"
ssh-keygen -t rsa -f ~/.ssh/repo2_rsa -C "repo2 deploy"

Cat the public keys and copy+paste them into each repo’s respective GitHub deploy key:

@devzakir
devzakir / bn.json
Created September 4, 2021 09:00
Vue i18n Translation
// de.json
{
"hello": "Guten tag"
}
@devzakir
devzakir / i18n.js
Created September 4, 2021 08:59
Vue i18n Translation
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
function loadLocaleMessages () {
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages = {}
locales.keys().forEach(key => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i)