Skip to content

Instantly share code, notes, and snippets.

View pipethedev's full-sized avatar
🎯
Focusing

Muritala David pipethedev

🎯
Focusing
View GitHub Profile
@pipethedev
pipethedev / pin-component.tsx
Created April 5, 2024 13:58
Pin component for brimble collaboration
import React, { useContext } from "react";
import { Thread, Pin } from "@cord-sdk/react";
import SupabaseImplementation from "@/implementations/supabase.implementation";
import { PinType } from "@/types/collaboration.type";
import GroupIdContext from "@/context/groupid.context";
import { Rnd } from "react-rnd";
const PinComment = (pinData: PinType) => {
const groupId = useContext(GroupIdContext) as string;
@pipethedev
pipethedev / model-migration.script.ts
Last active April 7, 2024 08:26
Convert object model to knex migrations
import fs from 'fs';
import path from 'path';
import { exec } from 'child_process';
enum KnexMigrationType {
Id = 'uuid',
String = 'string',
Number = 'integer',
Float = 'float',
Array = 'enum',
import { container } from 'tsyringe';
import { RateLimiterRedis } from 'rate-limiter-flexible';
import httpStatus from 'http-status';
import ms from 'ms';
import { ErrorResponse } from '@shared/utils/response.util';
import { RedisClient } from '@shared/utils/redis/redis-client/redis-client';
import { RateLimitingConfig } from '@shared/types/general.type';
const redisClient = container.resolve(RedisClient).get();
@pipethedev
pipethedev / idempotency.php
Created December 7, 2023 06:54
Idempotency
<?php
namespace App\Http\Middleware;
use App\Repository\TransactionRepository;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Validation\ValidationException;
@pipethedev
pipethedev / deployment.yml
Created October 12, 2023 16:27
deploy on multiple servers
name: Brimble Runner Deployment
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
public function name(): string {
return PaymentMethod::STRIPE;
}
protected function createPaymentIntent(string $setupIntentId, $user, $transaction): array
{
$setupIntent = SetupIntent::retrieve($setupIntentId);
$paymentMethodId = $setupIntent->payment_method;
@pipethedev
pipethedev / ts
Created July 1, 2023 11:22
search.ts
public async getRepos(installationId: number, { page, limit, q }: any, git: GIT_TYPE = GIT_TYPE.GITHUB) {
page = Number(page);
limit = Number(limit);
const deploymentProvider = DeploymentProvider.getProvider(git);
let data: any;
if (q) {
@pipethedev
pipethedev / encrypt.ts
Last active June 11, 2022 11:34
Node js laravel like encryption
import CryptoJS from "crypto-js";
class LaravelEncrypt{
public key: string;
constructor(key: string){
this.key = key;
}
public encrypt(data: string): string{
@pipethedev
pipethedev / index.ts
Last active April 10, 2022 22:45
Media upload with formdata
import axis from 'axios';
const formData = new FormData();
formData.append("assigned_page", "Room page");
formData.append("name", "Test Project");
formData.append("media", this.state.selectedFile);
async function upload(){
return await axios.post("<api_endpoint>", formData, {
headers: {
@pipethedev
pipethedev / content.html
Last active September 22, 2021 10:31
Editable
<!DOCTYPE html>
<html>
<head>
<title>Editable shit</title>
<style type="text/css">
#edit {background-color:#FFFF99;}
</style>
<script type="text/javascript">
function saveEdits() {