Skip to content

Instantly share code, notes, and snippets.

View imbhargav5's full-sized avatar

Bhargav Ponnapalli imbhargav5

View GitHub Profile
@imbhargav5
imbhargav5 / Queue.js
Created September 16, 2020 11:05
Queue with private class fields
class Queue{
#array = []
enqueue(val){
return this.#array.push(val);
}
dequeue(){
return this.#array.shift();
}
isEmpty(){
return this.#array.length == 0
@imbhargav5
imbhargav5 / Stack.js
Created September 16, 2020 11:03
Stack with private fields
class Stack{
#array = []
push(val){
return this.#array.push(val);
}
pop(){
return this.#array.pop();
}
isEmpty(){
return this.#array.length == 0
@imbhargav5
imbhargav5 / wiggle
Created July 20, 2020 19:48
Wiggle animation for a Button
import styled, {keyframes} from "styled-components"
const wiggle = keyframes`
0%,100%{
transform: scale(1.1) rotateZ(0deg) ;
}
16%,48%{
transform: scale(1.1) rotateZ(-3deg);
}
32%,64%{
@imbhargav5
imbhargav5 / machine.js
Last active December 15, 2019 12:58
Generated by XState Viz: https://xstate.js.org/viz
function randanimalSync(){
return "stuff"
}
function isSettings(context) {
return context.isSettings;
}
function onlyUserExists(context) {
return context.user && !context.user.name;
const jobs = [
{
id: 1,
title: "Lead Svelte Engineer",
description:
"Amet quo non reprehenderit aspernatur non ex tenetur debitis impedit. Dolor sed est. Dolorem assumenda molestiae vitae accusantium facilis incidunt rem soluta sint. Velit tenetur quae quibusdam occaecati fuga itaque tenetur ut.",
isFeatured: true,
isRemote: false,
seniority: "Lead",
verticals: ["Frontend"]
html,body{
display: none;
}
import * as React from "react";
import { useDidMount } from "shared/useDidMount";
const initialState = {
intersectionObj: {},
observerInState: null,
isVisible: false
};
interface Iaction {
@imbhargav5
imbhargav5 / SimpleTextInput_CWRP.js
Last active September 12, 2018 15:17 — forked from sagiavinash/SimpleTextInput_CWRP.js
SimpleTextInput with CWRP
class SimpleTextInput extend Component {
constructor(props){
super(props)
this.state = {
value : props.value,
_value : props.value
}
}
static getDerivedStateFromProps(newProps,oldState){
if(newProps.value !== oldState._value){
@imbhargav5
imbhargav5 / 000-default.conf
Last active December 28, 2017 19:33
Dockerfile for php+apache+phalcon
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName probuilds.dev
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www>
Options Indexes FollowSymLinks
@imbhargav5
imbhargav5 / download-pokemon-sprites.js
Created October 27, 2017 10:00
Download sprites from pokeapi to avoid hot linking
const download = require("image-downloader");
const path = require("path");
const pathExists = require("path-exists");
Array.from({ length: 802 }).forEach((i, index) => {
const entry = index + 1;
const downloadPath = path.join(__dirname, `public/images/${entry}.png`);
pathExists(downloadPath).then(exists => {
if (exists) {
return;