Skip to content

Instantly share code, notes, and snippets.

View dhruvilp's full-sized avatar
๐Ÿ’ญ
๐Ÿ‘จโ€๐Ÿ’ป working on something really cool

Dhruvil Patel dhruvilp

๐Ÿ’ญ
๐Ÿ‘จโ€๐Ÿ’ป working on something really cool
View GitHub Profile
@dhruvilp
dhruvilp / words.txt
Created January 27, 2022 21:38
Skribbl custom words
Back seat, Highchair, Rock band, Birthday, Hockey, Sasquatch, Black hole, Hotel, Scrambled eggs, Blizzard, Jump rope, Seat belt, Burrito, Koala, Skip, Captain, Solar eclipse, Chandelier, Light, Space, Crib, Mask, Stethoscope, Cruise ship, Mechanic, Stork, Dance, Mom, Sunburn, Deodorant, Mr Potato Head, Thread, Facebook, Pantyhose, Tourist, Paper plate, United States, Frame, Photo, WiFi, Full moon, Pilgrim, Zombie, Game, Pirate,Brain, Kitten, Playground, Bubble bath, Kiwi,Pumpkin pie, Buckle, Lipstick, Raindrop, Bus, Lobster ,Robot, Car, Lollipop, Sand castle, Castle, Magnet, Slipper, Chain saw, Megaphone, Snowball ,Circus tent, Mermaid, Sprinkler ,Computer, Minivan, Statue of Liberty, Crib ,Mount Rushmore ,Tadpole, Dragon, Music ,Teepee ,Dumbbell ,North pole, Telescope, Train, Ferris wheel ,Owl ,Tricycle, Flag ,Pacifier, Piano,Angry, Fireworks, Pumpkin ,Baby ,Flower ,Rainbow ,Beard, Flying saucer ,Recycle ,Bible, Giraffe ,Sand castle ,Bikini ,Glasses ,Snowflake, Book ,High heel, Stairs, Bucket ,Ice cream cone
@dhruvilp
dhruvilp / useKeyPress.js
Created January 26, 2022 20:45
useKeyPress React Hook
import React from "react";
import { useState, useEffect } from "react";
// Usage
export default function App() {
// Call our hook for each key that we'd like to monitor
const happyPress = useKeyPress("h");
const sadPress = useKeyPress("s");
const robotPress = useKeyPress("r");
const foxPress = useKeyPress("f");
const enterPress = useKeyPress("Enter");
@dhruvilp
dhruvilp / react_hook_interval.js
Created January 24, 2022 16:17
React Hook Interval
import {useEffect} from 'react';
export default function useIntervalHook(minutes = 5) {
const interval = minutes * 60 * 1000;
function refresh(){
fetch('/api/**', {mode: 'no-cors', credentials: 'include'})
.catch(error => {
console.log(`There was a problem... ${error.message}`);
});
@dhruvilp
dhruvilp / ip_to_dns.sh
Created November 16, 2021 02:49
CTF: Ping & get DNS name from a list of IPs saved in a file
#!/bin/zsh
#Ping & get DNS name from a list of IPs saved in a file
#Prompt the user to enter a file name and its path.
read -p "Enter the IP addresses file name / path:" FILE_PATH_NAME
function check_host(){
#if not the IP address value is empty
if [[ -n $IP_ADDRESS ]]
@dhruvilp
dhruvilp / main.dart
Created October 12, 2021 03:45
Flutter "Link" widget
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@dhruvilp
dhruvilp / html_parser.py
Created September 19, 2021 02:57
HTML Parser for DB2 Responses
from html.parser import HTMLParser
from html.entities import name2codepoint
keys = []
values = []
dataTypes = ["CHAR","VARCHAR","BOOL","BOOLEAN","SMALLINT","INT","INTEGER","DOUBLE","DECIMAL","DATE","DATETIME","TIMESTAMP"]
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
@dhruvilp
dhruvilp / EntityVarGenerator.java
Created September 16, 2021 17:57
Entity Variable Def Generator
import java.util.*;
import java.util.stream.*;
public class Main {
public static String dromedaryCamelCase(String inputStr) {
String bactrianCamel = Stream.of(inputStr.split("[^a-zA-Z0-9]")).filter(x -> x.length() > 0).map(v -> v.substring(0, 1).toUpperCase() + v.substring(1).toLowerCase()) .collect(Collectors.joining());
return bactrianCamel.toLowerCase().substring(0, 1) + bactrianCamel.substring(1);
}
@dhruvilp
dhruvilp / UseHistoryExample.jsx
Created August 16, 2021 23:23
React useHistory hook example
import React from "react";
import { BrowserRouter as Router,
Switch, Route, Link, useHistory} from "react-router-dom";
export default function BasicExample() {
return (
<Router>
<div>
<Switch>
<Route exact path="/">
@dhruvilp
dhruvilp / main.dart
Created July 10, 2021 04:44
Elevated Buttons - Flutter
/// Flutter code sample for SwitchListTile
// ![SwitchListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/switch_list_tile.png)
//
// This widget shows a switch that, when toggled, changes the state of a [bool]
// member field called `_lights`.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());