Skip to content

Instantly share code, notes, and snippets.

View TimMikeladze's full-sized avatar
🚏
debugging life

Tim Mikeladze TimMikeladze

🚏
debugging life
View GitHub Profile
@alfonsusac
alfonsusac / slide-in-transition.tsx
Last active October 26, 2023 06:01
Component Snippet to allow progressing forward and backward with slide-in animation like in iOS.
function Flow() {
const steps = ['new account', 'enter OTP', 'add pfp', 'add bio...' ] // The names doesn't matter, as long as its an array
const [step, setStep] = useState(0)
const handleNextStep = () => {
if(step < steps.length - 1) // limit max steps
setStep(prev => prev + 1)
}
const handlePrevStep = () => {
@jpvalery
jpvalery / _api_folder_incoming.js
Last active October 7, 2023 08:59
How to do fire-and-forget requests in NextJS using middleware (Slack FaaS serverless ack() alternative)
// path /api/folder/incoming.js
export default async function handler(req, res) {
let message = `hi from /api/folder/incoming`;
console.log(message);
console.log(req.body)
res.status(200).send(message);
return;
}
@AHilyard
AHilyard / import-github-labels.js
Created January 6, 2022 20:22
Import Github Labels via console commands
/*
This script will import Github labels from an array.
Optionally, existing labels can be removed prior to import.
Instructions:
Go to the labels page for the repo you'd like to import to (https://github.com/user/repo/labels)
Run the labels exporter script first, if you haven't. (https://gist.github.com/AHilyard/a5b9376d0326fd658a8064d5569791a4)
Modify this script by pasting your labels in where directed,
and optionally changing the "removeExisting" variable to true.
Press Enter
@AHilyard
AHilyard / export-github-labels.js
Last active April 19, 2023 12:56
Export Github Labels via console commands
/*
This script will export Github labels to an array.
This array can then be imported using the label importer script.
Instructions:
Go to the labels page for the repo you'd like to export from (https://github.com/user/repo/labels)
Paste this script in your console
Press Enter
Copy the resultant array into the importer script. (https://gist.github.com/AHilyard/5babebe06c30a48e07d949053e00bd5c)
*/
@ruizb
ruizb / README.md
Last active September 4, 2024 06:17
A glossary of TypeScript.

A glossary of TypeScript

Motivation

Once upon a time, there was a developer that had an issue using the TypeScript language. He wanted to share his issue with the community to get help, but he didn't know how to properly write the title that would best describe his problem. He struggled to find the appropriate words as he didn't know how to name "this behavior" or "that kind of type mechanism".

This story encouraged me to start writing a glossary of TypeScript. Hopefully it will help you if you have to look for an issue, write an issue, or communicate with other TypeScript developers.

Disclaimer: it was me, I was the developer that struggled. I still struggle though, but this means I still have things to learn, which is great!

@MitchPierias
MitchPierias / arangodb-ec2-linux.md
Last active December 9, 2022 21:32
Deploying ArnagoDB to an EC2 Linux Instance

ArangoDB Deployment to EC2 Linux Instance

Quickly get an ArangoDB instance running on an Amazon EC2 Linux Instance

Update existing package list and then install prerequieites.

sudo yum update -y

If your running a regular amazon linuz instance

sudo yum install docker

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@lfalke
lfalke / StripeCardsSection.js
Last active August 1, 2024 17:22
Usage of react-stripe-elements with Material UI (v1.0) styling
import React, { PureComponent } from 'react'
import Grid from 'material-ui/Grid'
import { CardNumberElement, CardExpiryElement, CardCVCElement } from 'react-stripe-elements'
import StripeElementWrapper from './StripeElementWrapper'
export default class extends PureComponent {
static displayName = 'StripeCardsSection'
@voodooattack
voodooattack / gql-directives.js
Last active January 5, 2020 09:57
GraphQL-Sequelize auto-model functionality. Directly translates the schema language into database models via directives.
const { parse, visit, print, Kind, BREAK } = require('graphql/language');
const { buildASTSchema } = require('graphql/utilities');
const { addResolveFunctionsToSchema } = require('graphql-tools');
const Sequelize = require('sequelize');
const { graphql } = require('graphql');
const jexl = require('jexl');
const deepAssign = require('deep-assign');
const { resolver: sequelizeResolver } = require('graphql-sequelize');
const { inspect } = require('util');
@voodooattack
voodooattack / combine-graphql.js
Last active February 6, 2022 15:11
Combine two GraphQL schemas
import { parse, visit, print } = from 'graphql/language';
/**
* Combine the fields of two or more AST nodes, does no error checking!
* @param types An array with types to combine.
* @returns {*}
*/
export function combineASTTypes(types) {
return types.reduce((p, n) => Object.assign(p, n, { fields: n.fields.concat(p.fields || []) }), {});
}