Skip to content

Instantly share code, notes, and snippets.

View lightningspirit's full-sized avatar
🏠
Working from home

Vitor Carvalho lightningspirit

🏠
Working from home
View GitHub Profile
@lightningspirit
lightningspirit / 2u_master_december_7th.csv
Last active December 11, 2018 09:34
2U Master December 7th
resource category country_code direction prefixes resolutions type price
CALL tollfree US inbound answered,missed,voicemail 0.012
CALL local US inbound answered,missed,voicemail 0.012
CALL US inbound answered,missed,voicemail 0.012
CALL tollfree AE inbound answered,missed,voicemail 0.67
CALL tollfree AR inbound answered,missed,voicemail 0.7
CALL local AR inbound answered,missed,voicemail 0.04
CALL local AT inbound answered,missed,voicemail 0.02
CALL tollfree AT inbound answered,missed,voicemail 0.59
CALL national AT inbound answered,missed,voicemail 0.04
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
country_code,country_name,category,price,prefixes,resource,direction,resolutions
AE,United Arab Emirates,,$0.27 ,9715,CALL,outbound,answered
AE,United Arab Emirates,,$0.27 ,971,CALL,outbound,answered
BR,Brazil,,$0.29 ,"551153, 551154, 551157, 55116, 55117, 55118, 55119, 55126, 55127, 55128, 55129, 55136, 55137, 55138, 55139, 55146, 55147, 55148, 55149, 55156, 55157, 55158, 55159, 55166, 55167, 55168, 55169, 55176, 55177, 55178, 55179, 55186, 55187, 55188, 55189, 5519, 55196, 55197, 55198, 55199, 55216, 55217, 55218, 55219, 55226, 55227, 55228, 55229, 55246, 55247, 55248, 55249, 55276, 55277, 55278, 55279, 55286, 55287, 55288, 55289, 55316, 55317, 55318, 55319, 55326, 55327, 55328, 55329, 5533, 55336, 55337, 55338, 55339, 55346, 55347, 55348, 55349, 55356, 55357, 55358, 55359, 55376, 55377, 55378, 55379, 55386, 55387, 55388, 55389, 55416, 55417, 55418, 55419, 55426, 55427, 55428, 55429, 55436, 55437, 55438, 55439, 55446, 55447, 55448, 55449, 55456, 55457, 55458, 55459, 55466, 55467, 55468, 55469, 55476, 55477,
@lightningspirit
lightningspirit / mu-passwords.php
Created August 25, 2020 16:58
Must-use WordPress plugin with a CLI command that resets passwords and generates a list of users with new passwords. It does not notify them. Plain simples user password reset mechanism that can be used for internal purposes.
<?php
/**
* Password management made easy
*
* @author Move Your Digital, Inc.
* @package Mu-Passwords
* @version 1.0.0
*/
/*
@lightningspirit
lightningspirit / react-lorem-ipsum.d.ts
Created September 14, 2020 21:59
Typescript typings for react-lorem-ipsum
declare module "react-lorem-ipsum" {
import React from "react"
interface AvatarProps {
gender?: "all" | "male" | "female"
className?: string
width?: number
height?: number
alt?: string
}
@lightningspirit
lightningspirit / shuffle.ts
Created February 12, 2021 16:11
Shuffle arrays
function shuffle<T>(array: T[]): T[] {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
@lightningspirit
lightningspirit / posts.json
Last active July 14, 2021 14:33
Posts for the Move Your Digital Blog Lorim Ipsum Challenge
[
{
"id": "1ddf64b0-6191-482e-b466-21f593560001",
"date": "2021-05-17T10:37:11",
"slug": "eiusmod-adipisicing-officia-do-pariatur-eu",
"title": "Ea reprehenderit non occaecat qui eiusmod Lorem ex anim enim deserunt incididunt exercitation nulla.",
"picture": {
"thumbnail": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=800&h=600",
"medium": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=1280&h=720",
"large": "https://images.unsplash.com/photo-1626131719997-e216ff236c40?fit=crop&q=80&w=1920&h=1080"
@lightningspirit
lightningspirit / info.json
Created August 17, 2021 10:07
WpPluginRepositoryTestCase
{
"name": "my-plugin-test"
}
@lightningspirit
lightningspirit / omit.ts
Created January 28, 2022 00:30
TypeScript Omit function
interface Omit {
<T extends Record<string, any>, K extends [...(keyof T)[]]>(
obj: T,
...keys: K
): {
[K2 in Exclude<keyof T, K[number]>]: T[K2]
}
}
const omit: Omit = (obj, ...props) => {
@lightningspirit
lightningspirit / cc.ts
Created February 4, 2022 18:51
ClassCat like function but simpler and smaller
function classNames(...classes: (boolean | string | string[])[]) {
return classes
.flatMap((v) => v)
.filter(Boolean)
.join(" ")
}
@lightningspirit
lightningspirit / README.md
Created February 17, 2022 21:46
Disable WordPress Admin Bar MU-Plugin

Disable WordPress Admin Bar MU-Plugin

Disable the admin bar for all users automatically.

Usage

  1. Download or copy the disable-admin-bar.php file
  2. Place it under wp-content/mu-plugins
  3. Done