Skip to content

Instantly share code, notes, and snippets.

View Teepheh-Git's full-sized avatar
💭
Focus

Oguntoyinbo Boluwatife Teepheh-Git

💭
Focus
View GitHub Profile
@Teepheh-Git
Teepheh-Git / redeem.ts
Last active September 26, 2024 08:29
SAME and Cross BRAND REDEM
//SAME BRAND
let isConnected = magicWeb3;
while (!isConnected) {
await delay(1000); // Wait for 1 second
isConnected = magicWeb3;
}
const { email: connectedEmail } = await magic.user.getInfo();
//IF THE PERSISTED USER INFO IS NOT THE INFO OF THE USER TRYING TO PERFORM THE FUNCTION logout and try to login again
if (email !== connectedEmail) {
{
"id": "6c2faa07-3c01-4b19-8c6c-798fb79c1b02",
"createdAt": "2023-12-22T15:22:30.151Z",
"updatedAt": "2024-03-22T14:39:02.057Z",
"brandId": "3e4c43a1-2abb-4a2c-b825-77ef2a232ab7",
"description": "Desiderio N.1 reward",
"slug": "bubble-revolution-1711030268707",
"rewardImage": "https://res.cloudinary.com/dlwsf8xgj/image/upload/v1703771559/tzejsfitgcgawszioqp8.jpg",
"otherRewardType": null,
"rewardSymbol": "BUB",
[
{
"id": "8e6cdaae-1b26-4be1-ad8e-db93493016cf",
"createdAt": "2023-12-06T08:12:28.662Z",
"updatedAt": "2023-12-06T08:12:28.662Z",
"name": "Children Category",
"description": "orem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt labore et dolore magna aliqua. Consequat nisl vel pretium lectus quam id. Semper quis lectus nulla at volutpat diam ut venenatis. Do",
"image": "https://res.cloudinary.com/digital-specie/image/upload/v1693854605/yolncm799wsd4eaqrk44.png",
"banner": "https://res.cloudinary.com/digital-specie/image/upload/v1693854839/kxbxk1zrpblyvmhulup9.jpg",
"slug": "children-category-1701850348660",
@Teepheh-Git
Teepheh-Git / .js
Last active February 13, 2024 15:27
upload category and sub-category
{
"name": "Sports & Outdoors",
"description": "orem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor\n incididunt labore et dolore magna aliqua. Consequat nisl vel pretium lectus quam id.\n Semper quis lectus nulla at volutpat diam ut venenatis. Do",
"image": "",
"banner": "",
"type": "sub-category",
"parentId": "9ade2a58-0ee2-6fea-a58d-e3fe72f9ced1"
}
https://api.memarketplace.io/category
@Teepheh-Git
Teepheh-Git / .js
Last active September 5, 2023 14:16
upload single img to cloudinary f
const [file, setFile] = useState<any>();
const [fileData, setFileData] = useState<any>();
const [fileDataArr, setFileDataArr] = useState<any>();
const [selectedFileData, setSelectedFileData] = useState<any[]>([]);
const [uploadProgress, setUploadProgress] = useState<string | null>(null);
const [currentFileIndex, setCurrentFileIndex] = useState<number | null>(null);
function handleChange(e: ChangeEvent<any>) {
let images: any[] = selectedImages;
import crypto from 'crypto';
export function getAesSecretKey() {
return crypto.randomBytes(16).toString('base64'); // Generate a 128-bit AES secret key (16 bytes) and convert it to Base64
}
export function getDecryptedSecretKey(key, privateKey) {
const privateKeyBuffer = Buffer.from(privateKey, 'base64');
const decryptedKeyBuffer = crypto.privateDecrypt(
privateKeyBuffer,
Buffer.from(key, 'base64'),
const readReceipt = async () => {
const readMessage = () => {
if (!socketRef.current) {
return;
}
socketRef.current.emit('readMessage', {message_id: '1', user_id: '7'});
};
};
let fileURL = URL(fileURLWithPath: "/Users/user/Downloads/appLogo.png")
let boundary = "Boundary-\(UUID().uuidString)"
let authorization = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDU4LCJpYXQiOjE2ODkwODgyNzcsImV4cCI6MTY5MTY4MDI3N30.3vtNJxke0QBl3wGLuIGMnDzH-JpI8p64MVmRxux0TwI"
var request = URLRequest(url: URL(string: "https://fricassa-staging.itskillscenter.com/upload/")!, timeoutInterval: Double.infinity)
request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
request.addValue(authorization, forHTTPHeaderField: "Authorization")
request.httpMethod = "POST"
let body = NSMutableData()
import UIKit
func uploadImageToURL(image: UIImage, url: URL, completion: @escaping (Error?) -> Void) {
guard let imageData = image.jpegData(compressionQuality: 0.8) else {
completion(nil)
return
}
var request = URLRequest(url: url)
request.httpMethod = "POST"
<!-- item_chat_message.xml -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<TextView
android:id="@+id/text_message"
android:layout_width="wrap_content"