Skip to content

Instantly share code, notes, and snippets.

@jiverson
jiverson / setup-typescript.sh
Created May 22, 2023 20:41 — forked from lewebsimple/setup-typescript.sh
TypeScript / ESLint / Prettier / Vue 3
#!/bin/bash
yarn add -D @typescript-eslint/eslint-plugin \
typescript ts-node-dev \
@typescript-eslint/parser @typescript-eslint/eslint-plugin eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue prettier
cat > .eslintrc.js <<EOF
module.exports = {
root: true,
env: {
@jiverson
jiverson / index.html
Created April 25, 2022 18:21
Sorting colors example
<h1>Sorting colors</h1>
<p>Example from <a href="https://tomekdev.com/posts/sorting-colors-in-js">https://tomekdev.com/posts/sorting-colors-in-js</a>. Go there to learn more about sorting colors.</p>
<section class="box">
<h2>Colors unsorted</h2>
<ul id="unsorted"></ul>
</section>
<section class="box">
<h2>Colors sorted</h2>
@jiverson
jiverson / DeepOmit.d.ts
Created January 28, 2022 13:50 — forked from ahuggins-nhs/DeepOmit.d.ts
Deeply omit members of an interface or type
// Taken from https://stackoverflow.com/questions/55539387/deep-omit-with-typescript
/** Union of primitives to skip with deep omit utilities. */
type Primitive = string | Function | number | boolean | Symbol | undefined | null
/** Deeply omit members of an array of interface or array of type. */
export type DeepOmitArray<T extends any[], K> = {
[P in keyof T]: DeepOmit<T[P], K>
}
@jiverson
jiverson / instance-loader.ts
Created March 17, 2021 16:23 — forked from mfdeveloper/instance-loader.ts
Creating TypeScript Classes Dynamically - Totally based on Steve Fenton solution
/**
* Creates a dynamic instance of a specific class/prototype.
* Minor changes from initial solution shared by **Steve Fenton**
*
* WARNING: This solution don't works on Angular applications,
* using JIT (because the webpack don't compiles classes into window object)
* or AOT (js minification for production build) compilation.
*
* @see https://www.stevefenton.co.uk/2014/07/creating-typescript-classes-dynamically/
*/
@jiverson
jiverson / http.js
Created March 16, 2021 21:29 — forked from moreta/http.js
axios interceptor sample code
/**
* src/api/http.js
*/
import axios from 'axios'
import qs from 'qs'
/**
*
* parse error response
*/
// input [[1,2,[3]],4] -> [1,2,3,4]
/**
* Assumptions
* 1. We don't need to take care of duplicates.
* 2. Arrays are only interger values.
* 3. No null or undefined values allowed.
*/
function run(input) {
@jiverson
jiverson / media-query.css
Created May 29, 2019 05:21 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@jiverson
jiverson / README-Template.md
Created May 17, 2019 00:03 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages