Skip to content

Instantly share code, notes, and snippets.

View doramatadora's full-sized avatar

Dora Militaru doramatadora

View GitHub Profile
@doramatadora
doramatadora / Glitch-Github-Actions-CI.md
Last active November 3, 2023 20:14
Automate Git -> Glitch repo sync via Github Actions

Automating deployments from Github to Glitch

💅 Copy & Paste 💅

🚨 This will wipe away any code in your Glitch project and replace it with the code from Github, and reload your project, every time you push to your repo's main branch.

In your Glitch project:

  1. Go to the Glitch 💻 Terminal and run the following:
@doramatadora
doramatadora / xml.jq
Created August 21, 2023 11:47
Convert JSON to XML with jq
# 💝 Use with jq 💝
# jq -r -f ./xml.jq some.json
# cat some.json | jq -r -f ./xml.jq
# Download or install jq from: https://jqlang.github.io/jq/download/
# Or: brew install jq
# Check out the manual: https://jqlang.github.io/jq/manual/
# To understand how content_key and attr_prefix work, run this script on the following JSON:
# https://gist.github.com/doramatadora/5623ea90e63ea1c6a15141e2fea054e8
@doramatadora
doramatadora / xmlLike.json
Created August 21, 2023 11:45
A JSON representation of XML data, with "@" attribute prefixes and "#text" content keys
{
"bookstore": {
"book": [
{
"id": "001",
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",
"publication_year": "1925",
"genre": {
"@type": "fiction",
@doramatadora
doramatadora / next.config.js
Created March 1, 2023 21:29
Next.JS webpack config change
module.exports = {
reactStrictMode: true,
webpack: (config, options) => {
config.externals = [
({request,}, callback) => {
// Allow Webpack to handle fastly:* namespaced module imports by treating
// them as modules rather than try to process them as URLs
if (/^fastly:.*$/.test(request)) {
return callback(null, 'commonjs ' + request);
}
@doramatadora
doramatadora / keybase.md
Created April 22, 2021 08:08
keybase.md

Keybase proof

I hereby claim:

  • I am doramatadora on github.
  • I am doramatadora (https://keybase.io/doramatadora) on keybase.
  • I have a public key ASDJ57Kvtk3HY474MMB1-HmfzTOhPZXu21-etHrqq3jkCQo

To claim this, I am signing this object:

@doramatadora
doramatadora / ascii-fox.txt
Created June 26, 2019 23:49
Everybody needs an ASCII fox
/\ /\
//\\_//\\ ____
\_ _/ / /
/ * * \ /^^^]
\_\O/_/ [ ]
/ \_ [ /
\ \_ / /
[ [ / \/ _/
_[ [ \ /_/
@doramatadora
doramatadora / mock-chained-api.ts
Created June 26, 2019 23:36
Mocking chained APIs with Jest, the easy way
// for when you want to mock/stub chained APIs
// useful with stuff like octokit, aws-sdk, neo4j-driver
// for avoiding nastiness, like, for e.g. octokit.git.getTree
// const octoStub = { octokit: { git: { getTree: jest.fn()) } } }
// this mocks/stubs everything to a specified depth
function mockChainedAPI(mock: any = jest.fn(), depth: number) {
return new Proxy({} as any, {
get: function(obj, prop) {
obj._depthCount = (obj._depthCount || 0) + 1;