Skip to content

Instantly share code, notes, and snippets.

Avatar
🍕
Writing bugs and features

Tulsi Prasad heytulsiprasad

🍕
Writing bugs and features
View GitHub Profile
@heytulsiprasad
heytulsiprasad / shopify-prop-types.js
Last active Nov 26, 2020
Validating prop types of results fetched by Shopify Storefront API
View shopify-prop-types.js
ProductForm.propTypes = {
product: PropTypes.exact({
description: PropTypes.string.isRequired,
descriptionHtml: PropTypes.string.isRequired,
handle: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
options: PropTypes.arrayOf(
PropTypes.exact({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
@heytulsiprasad
heytulsiprasad / animate.md
Last active Nov 16, 2020
10 tips for animations
View animate.md

Techniques to take care while using animations

1. Don’t change any properties besides opacity or transform!

Even if you think it might be ok, don’t!

2. Hide content in plain sight.

Use pointer-events: none along with no opacity to hide elements

3. Don’t animate everything at the same time.

Rather, use choreography.

@heytulsiprasad
heytulsiprasad / postfix-eval.c
Last active Oct 20, 2020
Write a program for postfix evaluation
View postfix-eval.c
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define MAX 50
int stack[MAX];
char post[MAX];
int top = -1;
void pushstack(int tmp);
void evaluate(char c);
@heytulsiprasad
heytulsiprasad / infix-postfix.c
Created Oct 20, 2020
Write a program for conversion from infix expression to postfix expression
View infix-postfix.c
#include<stdio.h>
#include<ctype.h>
char stack[100];
int top = -1;
void push(char x)
{
stack[++top] = x;
}
View semantic-commit-messages.md

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@heytulsiprasad
heytulsiprasad / intro.md
Created Oct 9, 2020
Alert me extension
View intro.md

🚨 Introducing Alert Me for Google Meet

A Chrome extension that uses the live captioning from a Meet conference to detect when specific words are spoken. You can set your own alert words in the popup interface. Never get caught while slacking off again :)

You can try out the extension by downloading the latest release from GitHub and follow the instructions in README. Link: https://github.com/heytulsiprasad/alert-me-google-meet

I'd love to know your feedback on this and how it can improve. This was my first time getting hands dirty on extensions, I'd love to discuss more ideas in future.

@heytulsiprasad
heytulsiprasad / optchains.js
Created Oct 7, 2020
Learning about Optional Chaining
View optchains.js
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
// fiddle: https://jsfiddle.net/tulsiprasad/hou3jrf8/120
const user = {
firstName: "Jade",
lastName: "Wilson",
address: {
home: {
street: "2502 Bennie Dr",
state: "Pearson, Georgia(GA)",
@heytulsiprasad
heytulsiprasad / cors.js
Last active Sep 26, 2020
Example setup for cors without using cors package
View cors.js
const origin =
process.env.NODE_ENV === "production"
? process.env.FRONTEND_PROD_URL
: process.env.FRONTEND_LOCAL_URL;
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", origin);
res.header("Access-Control-Allow-Credentials", true);
if (req.method === "OPTIONS") {
@heytulsiprasad
heytulsiprasad / .env
Last active Sep 20, 2020
Add mongoose to node and express
View .env
MONGO_PROD_URI=mongodb+srv://admin:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority
MONGO_DEV_URI=mongodb://127.0.0.1:27017/<dbname>
@heytulsiprasad
heytulsiprasad / tailwind.js
Created Sep 4, 2020
Config tailwind to desktop first approach
View tailwind.js
module.exports = {
theme: {
extend: {},
screens: {
xl: { max: "1279px" },
// => @media (max-width: 1279px) { ... }
lg: { max: "1023px" },
// => @media (max-width: 1023px) { ... }
You can’t perform that action at this time.