Skip to content

Instantly share code, notes, and snippets.

View waptik's full-sized avatar
💻
Learning JavaScript and ReactJS...

TheVirginBrokey waptik

💻
Learning JavaScript and ReactJS...
View GitHub Profile
@domitriusclark
domitriusclark / useSearch.js
Created June 25, 2020 14:47
useSearch describes a way to handle piping options to a serverless endpoint that actually handles the search
import { useMutation } from 'react-query';
import fetch from 'isomorphic-unfetch';
export default function useSearch({ endpoint } = {}) {
if (!endpoint) {
throw new Error("Must provide an endpoint to search");
}
let expressionConfig = "";
@manuelbieh
manuelbieh / README.md
Last active November 18, 2024 15:12
Deno File Download

Use Deno to download files from the internet.

Usage

deno run --allow-net --allow-write download.ts [url] [filename]

Example

@silvioramalho
silvioramalho / react-native-authentication.md
Last active May 25, 2025 11:21
Creating React Native Authentication

Creating React Native Authentication

Creating a complete authentication flow using context-api. (Step-by-step)

This flow can be replicated to React-JS (Web)

Creating App

npx react-native init reactNativeAuth --template react-native-template-typescript

@TechRova
TechRova / upload.service.ts
Created May 14, 2020 18:04
Upload Service
import { Injectable } from '@angular/core';
import * as AWS from 'aws-sdk/global';
import * as S3 from 'aws-sdk/clients/s3';
@Injectable({
providedIn: 'root'
})
export default class UploadService {
constructor() { }
@timc1
timc1 / useTheme2.tsx
Created April 18, 2020 20:10
🌑☀️core app system/light/dark mode theming + varying themes for nested components
import * as React from "react";
type ThemeConfig = "system" | "light" | "dark";
type ThemeName = "light" | "dark";
// Custom themes are keyed by a unique id.
type KeyedThemes = {
[k: string]: {
config: ThemeConfig;
themeName: ThemeName;
};
export default (function create(options = {}) {
const client = {
headers: options.headers || {},
create
};
const events = {};
client.emit = (type, e) => {
events[type] &&
events[type].slice().map(fn => {
@samselikoff
samselikoff / cloudSettings
Last active January 10, 2024 21:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-01T19:06:41.818Z","extensionVersion":"v3.4.3"}
@agmm
agmm / nextjs-file-upload-api.js
Created January 31, 2020 23:03
Simple Nextjs File Upload — Backend API
// Backend
import formidable from 'formidable';
export const config = {
api: {
bodyParser: false,
},
};
export default async (req, res) => {
@imdkbj
imdkbj / setwebhook.js
Created January 27, 2020 16:01
Setup to listen telegram multiple bots on webhooks.
const axios = require('axios');
const apiurl = 'https://api.telegram.org/bot';
const serveraddress = 'https://yourdomain.com';
const tokens = ['3445345345:454545-iY_wE6wj_aKDJwKLXk', '453454545:gffgfgzbcfjhsdbflhjdsfvhjlvdsf'];
//set webhook
//you can make this as call as way you want.
webhookURL(tokens, 50, 8443, 'tgram');
async function webhookURL(bot_tokens, max_connections, port, from) {
@BryceAMcDaniel
BryceAMcDaniel / getToken.ts
Created December 23, 2019 15:34
auth0 specific withApolloHOC for use with SSR in next.js.
import auth0 from '../../lib/Auth0/config';
export default async function session(req, res) {
try {
// console.log(req);
const { accessToken } = await auth0.getSession(req);
if (accessToken) res.send(accessToken);
res.status(500).end(accessToken);
} catch (error) {