Skip to content

Instantly share code, notes, and snippets.

View jaypeah2's full-sized avatar
🎯
Focusing

John Paul Hayes jaypeah2

🎯
Focusing
View GitHub Profile
@jaypeah2
jaypeah2 / example_session.tsx
Created February 26, 2025 00:55
A quick example of a static TypeScript class for use in a React application. Includes example API function which takes view-defined functions as parameters.
export default class Session {
static TOKEN_KEY = "PAGE_TOKEN_KEY";
static token = (localStorage.getItem(this.TOKEN_KEY) === null ? "" : localStorage.getItem(this.TOKEN_KEY));
static verified = false;
static isLocalhost = window.location.hostname.includes("localhost");
static apiBaseurl = (this.isLocalhost ? "http://localhost:9000" : "https://api.example.com");
static someCachedData: any[] = [];
static currentUser: any = undefined;
username@hostname$ sed -n "s/\$table_prefix = '\(.*\)';/\1/p" wp-config.php
@jaypeah2
jaypeah2 / af_packet_classic.c
Created October 24, 2016 20:43 — forked from pavel-odintsov/af_packet_classic.c
af_packet_classic_habrahabr
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <arpa/inet.h>
#include <sys/socket.h>