Skip to content

Instantly share code, notes, and snippets.

@emelcd
Created April 25, 2022 19:29
Show Gist options
  • Save emelcd/8e7ed1e12a6fbc043199d597394829ad to your computer and use it in GitHub Desktop.
Save emelcd/8e7ed1e12a6fbc043199d597394829ad to your computer and use it in GitHub Desktop.
Search for the gonzalo
import "./style.css";
const categoriesToSearch = [
"Tunisian Restaurant",
"Hypnotherapy Service",
"Armenian Restaurant",
"Water Damage Restoration Service",
"Lumber Store",
"Tire Shop",
"School District",
"Insulation Contractor",
"Handyman",
"Cabin Rental Agency",
"Car Inspection Station",
"Veterinary Care",
"Tax Preparation",
"Pottery Store",
"Trailer Rental Service",
"Payphone",
"Snow Removal Service",
"Cape Verdean Restaurant",
"Nanny",
"Macrobiotic Restaurant",
"Western Apparel Store",
"Uruguayan Restaurant",
"Dog Breeder",
"Natural Foods Store",
"Equipment Rental Agency",
"Masonry Supply Store",
"Wedding Bakery",
"Hair Care",
"Stage Lighting Equipment Supplier",
"Oriental Rug Store",
"Mercedes Benz Dealer",
"Custom T-shirt Store",
"Athletic Track",
"Pressure Washing Service",
"Transcription Service",
"Newsstand",
"Grocery Store or Supermarket",
"Go Kart Track",
"Trophy Shop",
"Political Party",
"Korean Restaurant",
"Vending Machine Supplier",
"State Government Office",
"Public Works Department",
"Dental Supply Store",
"Snowmobile Dealer",
"Social Services Organization",
"Shoal",
"Retirement Community",
"Pentecostal Church",
"Osteopath",
"River",
"Home Builder",
"Wig Shop",
"Video Equipment Repair Service",
"Lawn Care Service",
"After School Program",
"Aikido School",
"Candle Store",
"Oncologist",
"Rock Shop",
"Chevrolet Dealer",
"Wedding Chapel",
"Drinking Water Fountain",
"Non-Denominational Church",
"Electrolysis Hair Removal Service",
"Fiberglass Supplier",
"Grill Store",
"Criminal Justice Attorney",
"Medical Examiner",
"Italian Restaurant",
"Violin Shop",
"Meal Takeaway",
"Indian Reservation",
"School",
"Public Utility",
"Chicken Restaurant",
"Drug Addiction Treatment Center",
"Surplus Store",
"Roofing Contractor",
"Credit Reporting Agency",
"Deli",
"Wine Storage Facility",
"Table Tennis Supply Store",
"Tex-Mex Restaurant",
"Uzbeki Restaurant",
"Beach Resort",
"Condominium Rental Agency",
"Internet Cafe",
"Fissure",
"Wheel Alignment Service",
"Auto Tune Up Service",
"Gourmet Grocery Store",
"Toll Road Rest Stop",
"Dress Shop",
"Plant Nursery",
"Water Park",
"Picnic Ground",
"Dairy Supplier",
"Dive Shop",
"Patisserie",
"Police Department",
"Construction Equipment Supplier",
"Timeshare Agency",
"Diagnostic Center",
"Commercial Real Estate Agency",
"Homeless Shelter",
"Convention Center",
"Material Handling Equipment Supplier",
"Diesel Fuel Supplier",
"Lawn Sprinkler System Contractor",
"Tanning Salon",
"Saw Sharpening Service",
"Drum Store",
"Emergency Care Physician",
"Alsace Restaurant",
"Federal Courthouse",
"Acupuncture School",
"Bail Bonds Service",
"Full Gospel Church",
"Countertop Store",
"Pizza Delivery",
"Sports Memorabilia Store",
"Architectural Salvage Store",
"Border Crossing Station",
"Water Ski Shop",
"Eritrean Restaurant",
"Vegan Restaurant",
"Alliance Church",
"Plastic Bag Supplier",
"Pet Cemetery",
"Newspaper Advertising Department",
"Fondue Restaurant",
"Dude Ranch",
"Preparatory School",
"Dog Walker",
"Lamp Repair Service",
"Scale Repair Service",
"ATM",
"Commercial Printer",
"Observation Deck",
"Squash Club",
"Rest Stop",
"Water Jet Cutting Service",
"Game Store",
"Outdoor Furniture Store",
"Convention Information Bureau",
"Lava Field",
"Asian Fusion Restaurant",
"Abbey",
"Monogramming Service",
"Down Home Cooking Restaurant",
"Tapas Bar",
"Student Housing Center",
"Youth Club",
"Auto Auction",
"Beauty Products Vending Machine",
"University",
"Kazakhstani Restaurant",
"Immigration & Naturalization Service",
"Tennis Court Construction Company",
"Car Leasing Service",
"Sperm Bank",
"Ham Shop",
"Singles Organization",
"Tennis Store",
"Teeth Whitening Service",
"Tourist Attraction",
"Magazine Publisher",
"Bus Stop",
"Naval Base",
"Fiberglass Repair Service",
"Boat Trailer Dealer",
"Homeless Service",
"Audiologist",
"Business Management Consultant",
"Tent Rental Service",
"Internet Marketing Service",
"SCUBA Tour Agency",
"Furniture Store",
"Piano Moving Service",
"Map Store",
"Airport Shuttle Service",
"Adoption Agency",
"Laser Hair Removal Service",
"Fishing Lake",
"Civic Center",
"Bubble Tea",
"Blood Testing Service",
"National Park",
"Railroad Company",
"Laboratory",
"Health Consultant",
"Indian Restaurant",
"Money Order Service",
"Box Lunch Supplier",
"Lamp Store",
"Jewelry Repair Service",
"Massage School",
"Insurance Attorney",
"Wheelchair Rental Service",
"Danish Restaurant",
"Seafood Market",
"Event Venue",
"Hardware Store",
"Demolition Contractor",
"Propeller Shop",
"Costume Store",
"Telecommunications Contractor",
"Road Construction Company",
"Swamp",
"Polish Restaurant",
"Frozen Dessert Supplier",
"Steel Fabricator",
"Fertilizer Supplier",
"Sea Port",
"Gay & Lesbian Organization",
"Cannery",
"Salvage Yard",
"Tool Repair Shop",
"Crisis Center",
"Creole Restaurant",
"Alternator Supplier",
"Egyptian Restaurant",
"Gluten-Free Restaurant",
"Work Clothes Store",
"Used Car Dealer",
"Forest",
"Graphic Designer",
"Airstrip",
"Science Museum",
"Pontiac Dealer",
"Radio Broadcaster",
"Airport Parking Lot",
"Emergency Care Facility",
"Russian Orthodox Church",
"Public Call Office Booth",
"Little League Club",
"Venezuelan Restaurant",
"Sinkhole",
"State Park",
"Tattoo Shop",
"Produce Market",
"Chinese Restaurant",
"Vacation Home Rental Agency",
"Copier Repair Service",
"Internet Service Provider",
"Private Hospital",
"Pond Supply Store",
"Shopping Mall",
"Upholstery Cleaning Service",
"Statuary",
"Saab Dealer",
"Mailbox Rental Service",
"Isthmus",
"RV Storage Facility",
"Winery",
"Wholesale Bakery",
"Fertility Physician",
"Taiwanese Restaurant",
"Winemaking Supply Store",
"Food Bank",
"Used Furniture Store",
"Apartment Complex",
"Resume Service",
"Social Security Office",
"Pumpkin Patch",
"Tourist Information Center",
"Warehousing Service",
"Abortion Clinic",
"Car Service",
"Sportswear Store",
"Baptist Church",
"Psychic",
"Health Club",
"Outboard Motor Store",
"Shrine",
"Weather Station",
"Granite Supplier",
"Construction Company",
"Transportation Service",
"Pony Ride Service",
"X-ray Equipment Supplier",
"Savings Bank",
"Diner",
"Reformed Church",
"Airplane",
"French Steakhouse Restaurant",
"Auto Dent Removal Service",
"Cocktail Bar",
"Sailing School",
"Furnace Parts Supplier",
"Canoe & Kayak Tour Agency",
"Kung Fu School",
"DJ Supply Store",
"Coffee Store",
"Public Safety Office",
"Foster Care Service",
"Public Defender's Office",
"Sporting Goods Store",
"Environmental Consultant",
"Engineering Consultant",
"Wallpaper Store",
"Surf Shop",
"Needlework Shop",
"Orthopedic Surgeon",
"Boat Ramp",
"Diabetes Center",
"Screen Printing Supply Store",
"Volcano",
"Preschool",
"Cafe",
"Armenian Church",
"Urban Planning Department",
"Motorcycle Shop",
"Snowboard Rental Service",
"Sports Card Store",
"Used Musical Instrument Store",
"Arena",
"Middle Eastern Restaurant",
"Volunteer Organization",
"Valencian Restaurant",
"Government Office",
"Used Office Furniture Store",
"Holiday Park",
"Gun Shop",
"Moravian Church",
"Maltese Restaurant",
"Midwife",
"Sheet Metal Contractor",
"Light Bulb Supplier",
"Orthopedic Shoe Store",
"Group Home",
"Cricket Club",
"Human Resource Consulting",
"Car Dealer",
"Japanese Curry Restaurant",
"House Sitter",
"HVAC Contractor",
"Dam",
"Food Court",
"Urologist",
"Quilt Shop",
"Medical Center",
"Lamp Shade Supplier",
"Venetian Restaurant",
"Veterans Affairs Department",
"Pho Restaurant",
"Sanitation Service",
"Molding Supplier",
"Fish Farm",
"Medical Spa",
"Spa Resort",
"Antique Store",
"Literacy Program",
"Video Game Rental Kiosk",
"Volleyball Club",
"Scale Supplier",
"Ford Dealer",
"Driver's License Office",
"Russian Restaurant",
"Kosher Restaurant",
"Mountain Slope",
"Hoagie Restaurant",
"Bottled Water Supplier",
"Auto Spring Shop",
"Calvary Chapel Church",
"Anago Restaurant",
"Home Insurance Agency",
"School Bus Service",
"Real Estate Rental Agency",
"Fjord",
"Electric Vehicle Charging Station",
"Power Plant Equipment Supplier",
"Dairy Farm",
"Reenactment Site",
"Electrician",
"Motorcycle Repair Shop",
"Accountant",
"Tool & Die Shop",
"Aqueduct",
"Hydraulic Repair Service",
"Anglican Church",
"Culinary School",
"Airport Terminal",
"Cleaners",
"Telecommunications Service Provider",
"Industrial Gas Supplier",
"Screen Store",
"House Cleaning Service",
"Mental Health Service",
"Wholesale Jeweler",
"Nicaraguan Restaurant",
"Flooring Contractor",
"Monorail Station",
"Hot Dog Stand",
"Greek Orthodox Church",
"Drama School",
"Elevator Service",
"Golf Course",
"African Restaurant",
"Volleyball Court",
"Blueprint Service",
"Persian Restaurant",
"Charter School",
"Fire Protection Consultant",
"Landscape Lighting Designer",
"Watch Store",
"War Memorial",
"Continental Restaurant",
"Seafood Restaurant",
"Periodontist",
"Tool Grinding Service",
"Labor Union",
"Fence Contractor",
"Muffler Shop",
"Archaeological Site",
"Cable Car Station",
"North African Restaurant",
"Power Plant Consultant",
"Swim Club",
"Thai Restaurant",
"Small Plates Restaurant",
"Bight",
"Denture Care Center",
"Guatemalan Restaurant",
"Delta",
"Business Center",
"Free Clinic",
"Salvadoran Restaurant",
"Registry Office",
"Gift Wrap Store",
"Video Game Store",
"Buick Dealer",
"Private Golf Course",
"Icelandic Restaurant",
"Watch Repair Service",
"Townhouse Complex",
"Raft Trip Outfitter",
"Discount Supermarket",
"Log Home Builder",
"Dance Hall",
"Pinatas Supplier",
"Finnish Restaurant",
"Health Insurance Agency",
"Glass Blower",
"Camp",
"Apostolic Church",
"Recording Studio",
"Event Management Company",
"Hydraulic Equipment Supplier",
"Convenience Store",
"Taekwondo School",
"Video Arcade",
"Archive",
"Passport Photo Processor",
"Building Materials Store",
"Educational Testing Service",
];
/* ESTO ES SOLO PARA CREAR LA TABLA */
const table = document.createElement("table");
const tbody = document.createElement("tbody");
categoriesToSearch.forEach((category, idx) => {
const tr = document.createElement("tr");
const td = document.createElement("td");
const td2 = document.createElement("td");
const td3 = document.createElement("td");
td.innerText = category;
td2.innerText = Math.random() > 0.5 ? "Yes" : "No";
td3.innerText = idx + 1;
tr.appendChild(td3);
tr.appendChild(td);
tr.appendChild(td2);
tbody.appendChild(tr);
table.appendChild(tbody);
});
/* ESTO ES PARA CREAR EL INPUT */
const input = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("placeholder", "Search");
input.setAttribute("id", "search");
input.addEventListener("keyup", handlerSearch());
function handlerSearch() {
return (e) => {
const search = e.target.value.toLowerCase();
const trs = tbody.querySelectorAll("tr");
trs.forEach((tr) => {
/* SELECCIONAMOS LA SEGUNDA CELDA Y COMPROBAMOS QUE INCLUYA EL TEXTO DE LA BUSQUEDA */
const td = tr.querySelectorAll("td")[1];
const category = td.innerText.toLowerCase();
if (category.indexOf(search) > -1) {
tr.style.display = "table-row";
} else {
tr.style.display = "none";
}
});
};
}
/* Añadimos los elementos creados, esto se puede añadir como HTML */
app.appendChild(input);
app.appendChild(table);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment