Skip to content

Instantly share code, notes, and snippets.

View swashata's full-sized avatar
🏡
Working from home

Swashata Ghosh swashata

🏡
Working from home
View GitHub Profile
@subfuzion
subfuzion / README.md
Last active August 29, 2023 01:41
Node.js 18 Test Runner

Node.js 18 Test Runner

Node.js v18 introduces test runner support. This currently experimental feature gives developers the benefits of a structured test harness for their code without having to install a third party test framework, like Mocha or Jest, as a dependency. Using the test runner produces [TAP] output.

The [online reference] provides the most up-to-date, authoritative reference and have plenty of good testing examples. However, there are a few points that might not be immediately obvious from the reference, so those are highlighted here.

@SPodjasek
SPodjasek / Formik-Autosave.tsx
Last active August 2, 2022 14:56 — forked from jaredpalmer/Formik-Autosave.jsx
Formik-Autosave with internal state for holding submitted values and optional visible status presentation
import { useFormikContext } from 'formik';
import debounce from 'lodash/debounce';
import React, { useCallback, useEffect, useState } from 'react';
import isEqual from 'react-fast-compare';
type AutoSaveFieldsStates = 'changed' | 'saved' | undefined;
export type AutoSaveFieldsStatusRenderer = (
state: 'submitting' | AutoSaveFieldsStates
) => React.ReactNode;
@xnau
xnau / wp-locale-conversion-array.php
Created February 1, 2019 19:56
Conversion array for WordPress locale codes and standard language codes and names
<?php
$wp_locale_conversion = array(
'af' => array(
'name' => 'Afrikaans',
'code' => 'af',
'wp_locale' => 'af'
) ,
'ak' => array(
'name' => 'Akan',
'code' => 'ak',
@kevinsperrine
kevinsperrine / gatito.itermcolors
Last active May 19, 2020 19:28
Gatito Color theme for iTerm
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.18039216101169586</real>
@MoOx
MoOx / README.md
Last active May 11, 2023 13:59
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
@samthor
samthor / safari-nomodule.js
Last active February 14, 2024 02:54
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@Narayon
Narayon / config_mac.md
Created March 6, 2017 02:58
Config MacOs machine

macOS

Custom recipe to get macOS running from scratch, setup applications and (WordPress) developer environment. I use this gist to keep the steps required to have a functioning system after a semi-annual fresh install.

Software

Browsers

System

Cheatsheet

Move cursor

command description
ctrl+a Move cursor to the start of the line
ctrl+e Move cursor to the end of the line
or ctrl+b Move cursor back one character
▶ or ctrl+f Move cursor forward one character
@jonsuh
jonsuh / .bash_profile
Last active February 16, 2024 17:17
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@martarf
martarf / wp-unit-test.md
Last active June 15, 2017 11:44
Wordpress Plugin Unit Tests

WP PLUGIN UNIT TEST

You will need svn, PHPUnit and wp-cli (they are provided by VVV). Make sure you have them installed.

###1. Set up

Initialize your testing environment using install-wp-tests.sh script.This script installs a copy of Wordpress in the /tmp directory (by default) as well as the Wordpress unit testing tools. Then it creates the specified database to be used while running tests.