Skip to content

Instantly share code, notes, and snippets.

View gtchakama's full-sized avatar
🌿
Full-Stack Developer

George T Chakama gtchakama

🌿
Full-Stack Developer
View GitHub Profile
@gtchakama
gtchakama / code.gs
Created November 15, 2024 06:48
Google App Script - Telegram Notifications
// Configuration
const CONFIG = {
BOT_TOKEN: ':',
CHAT_ID: '',
IMPORTANT_SENDERS: [
'[email protected]', '[email protected]',
],
KEYWORDS: ['urgent', 'important', 'deadline'],
CHECK_INTERVAL_MINUTES: 5,
REMINDER_INTERVALS: [3, 10, 30, 60, 180, 300, 600] // in minutes
@gtchakama
gtchakama / app.js
Created September 28, 2024 18:14
Buy Seats Component
import React, { useState } from 'react';
const BuyNowButton = ({ remainingSeats }) => {
const [isHovered, setIsHovered] = useState(false);
const borderColor = 'rgb(229, 231, 235)'; // Tailwind's gray-200
const buttonColor = 'rgb(243, 244, 246)'; // Tailwind's gray-50
return (
@gtchakama
gtchakama / app.js
Created September 28, 2024 14:24
Password Verification Component
"use client";
import React, { useState } from 'react';
import { EyeIcon, EyeOffIcon } from 'lucide-react';
const PasswordVerification = () => {
const [password, setPassword] = useState('');
const [confirmPassword, setConfirmPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
@gtchakama
gtchakama / app.md
Created September 17, 2024 06:55
Tools to generate images to get your app on the play store.

Asset Generation for Play Store

To successfully publish your app on the Google Play Store, it’s essential to have high-quality images for icons and promotional assets. Below are some tools and resources to help you generate the required assets quickly and effectively.

1. App Icons and 512 x 512 Play Store Icon

The Play Store requires a 512 x 512 high-resolution app icon to display in listings. The tools below will help you create these icons easily:

  • Android Asset Studio
    This is a versatile tool for generating app icons in multiple sizes for Android apps. It also allows you to create the required 512 x 512 Play Store icon.
  • How to use:
@gtchakama
gtchakama / page.js
Created July 15, 2024 15:37
This React component, Gemini, integrates with Google's Generative AI to analyze images. Users can upload an image and select a character from a predefined list, such as "William Shakespeare" or "A Scientist". The AI then generates a description of the image as if narrated by the selected character. Here's an overview of the component's functiona…
import { useState } from "react";
import { GoogleGenerativeAI } from "@google/generative-ai";
function Gemini() {
// State variables to manage component data
const [loading, setLoading] = useState(false);
const [apiData, setApiData] = useState("");
const [selectedFile, setSelectedFile] = useState(null);
const [selectedCharacter, setSelectedCharacter] = useState("");
const [whoSpoke, setWhoSpoke] = useState("");
@gtchakama
gtchakama / message.jsx
Created July 2, 2024 02:33
An input component that morphs its content into a message bubble when submitted. Made possible with layout animations in Framer Motion. Inspired by iOS.
import { PlusIcon } from "@radix-ui/react-icons";
import { AnimatePresence, motion } from "framer-motion";
import { useState } from "react";
const transitionDebug = {
type: "easeOut",
duration: 0.2,
};
export default function InputMorphMessage() {
@gtchakama
gtchakama / main.js
Last active June 13, 2024 18:57
Gemini Template for image processing
import { useState } from "react";
import { GoogleGenerativeAI } from "@google/generative-ai";
function Gemini() {
const [loading, setLoading] = useState(false);
const [apiData, setApiData] = useState("");
const [selectedFile, setSelectedFile] = useState(null);
const genAI = new GoogleGenerativeAI(process.env.NEXT_PUBLIC__API_GEN_API);
@gtchakama
gtchakama / app.js
Created September 3, 2023 08:05
ReactJS File Upload
import React, { useState } from 'react';
import axios from 'axios';
// Define a functional component called FileUpload
const FileUpload = () => {
// Declare two state variables using the useState hook:
// - selectedFile: to store the currently selected file
// - uploadStatus: to display the upload status message
const [selectedFile, setSelectedFile] = useState(null);
@gtchakama
gtchakama / index.js
Created August 23, 2023 10:26
NodeJS CRUD With Postgres
const express = require('express');
const { Pool } = require('pg');
const app = express();
const port = process.env.PORT || 3000;
const pool = new Pool({
user: 'your_db_user',
host: 'localhost',
database: 'your_db_name',
@gtchakama
gtchakama / app.rb
Created August 8, 2023 09:37
A search filter to an array of objects in Ruby
# Sample array of user objects
users = [
{ id: 1, first_name: "John", last_name: "Doe", age: 30, email: "[email protected]" },
{ id: 2, first_name: "Jane", last_name: "Smith", age: 25, email: "[email protected]" },
{ id: 3, first_name: "Michael", last_name: "Johnson", age: 35, email: "[email protected]" },
{ id: 4, first_name: "Emily", last_name: "Brown", age: 28, email: "[email protected]" }
]
# Function to apply the search filter
def search_users(query, users)