This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ReactElement, ReactNode } from "react"; | |
import { I18nKey, i18n } from "./i18n"; | |
interface TransProps { | |
i18nKey: I18nKey; | |
text?: string; | |
[x: string]: ReactNode; | |
} | |
const Trans = ({ i18nKey, text, ...interpolationData }: TransProps) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
USAGE = <<~DOC | |
USAGE: | |
ruby json_csv_converter.rb <in_file> <separator(optional)> | |
EXAMPLES: | |
Convert JSON to CSV | |
$ ruby json_csv_converter.rb file.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from 'crypto' | |
// inputs | |
const key = 'notsosecret' | |
const method = 'POST' | |
const url = 'https://example.com' | |
const timestamp = '2022-11-03T01:08:19.138Z' | |
const data = '{"data":{"partnerId":"1","tokenId":47210468}}' | |
// generate signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { firestore } from 'firebase-admin'; | |
import * as functions from 'firebase-functions'; | |
const region = 'europe-west1'; | |
const firestoreCollection = 'webhook-posts'; | |
export const httpBin = functions | |
.region(region) | |
.https.onRequest(async ({ headers, body }, response) => { | |
const data = { headers, body }; | |
await firestore().collection(firestoreCollection).doc().create(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recursiveRedact({ a: 1, b: { a: 1, b: 2 } }, new Set(['a'])) | |
// Result | |
// { | |
// "a": "[redacted]", | |
// "b": { | |
// "a": "[redacted]", | |
// "b": 2 | |
// } | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE | |
# In any local GitHub repository run | |
# $ github_open | |
github_open() { | |
local remotename="${@:-origin}" | |
local remote="$(git remote -v | awk '/^'"$remotename"'.*\(push\)$/ {print $2}')" | |
[[ "$remote" ]] || return | |
local user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')" | |
open "https://github.com/$user_repo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.ruby': | |
'def method_missing .. end': | |
'prefix': 'defmm' | |
'body': | |
''' | |
def method_missing(method_name, *arguments, &block) | |
if ${1}.respond_to?(method_name) | |
${1}.public_send(method_name, *arguments, &block) | |
else | |
super |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# USAGE: | |
# $ check_redirects --help | |
# or | |
# $ ruby check_redirects.rb --help | |
require 'bundler/inline' | |
gemfile do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.ruby': | |
'Insert gem configuration block': | |
'prefix': 'gconfig' | |
'body': | |
''' | |
def self.configuration | |
@configuration ||= Configuration.new | |
end | |
def self.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.ruby': | |
'Insert Ruby optparser': | |
'prefix': 'optparse' | |
'body': | |
''' | |
require 'optparse' | |
options = {} |
NewerOlder