Skip to content

Instantly share code, notes, and snippets.

View pipethedev's full-sized avatar
🎯
Focusing

Ileri⚡️ pipethedev

🎯
Focusing
View GitHub Profile
@pipethedev
pipethedev / setup
Last active April 19, 2025 16:43
Pre setup script to download maxmind db configuration file for hosting malak
apk add --no-cache curl && mkdir -p /app/storage/maxmind && curl -L -o /app/storage/maxmind/city.mmdb https://ileri.b-cdn.net/GeoLite2-City.mmdb && curl -L -o /app/storage/maxmind/country.mmdb https://ileri.b-cdn.net/GeoLite2-Country.mmdb
INSERT INTO "public"."plans"("id","reference","plan_name","default_price_id","amount","metadata","created_at","updated_at","deleted_at","is_default")
VALUES
(E'4590c0bb-7dc1-4ec0-abef-61eb305059d1',E'prod_RxAyUR2',E'Core',E'price_1R3GcuIuzgc0GU',3000,E'{"deck": {"analytics": {"can_view_historical_sessions": false}}, "updates": {"max_recipients": 300}}',E'2025-03-16 21:27:38.685084+00',E'2024-09-04 13:46:35.612449+00',NULL,TRUE);
@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: {