Skip to content

Instantly share code, notes, and snippets.

View kukalajet's full-sized avatar
🎯
Focusing

Jeton Kukalaj kukalajet

🎯
Focusing
View GitHub Profile
@derekstavis
derekstavis / Toast.tsx
Last active May 16, 2024 14:13
React Native Toast, without Context hell
/* Layout and Text components are my own utility components. Replace them by your own. */
import { memo, useEffect, useMemo, useState } from "react";
import { ViewStyle } from "react-native";
import { A } from "@mobily/ts-belt";
import mitt from "mitt";
import { v4 as uuid } from "@lukeed/uuid";
import Animated, {
Layout as REALayout,
Easing,
@Marlinski
Marlinski / BottomSheetScaffold.kt
Created October 23, 2022 21:48
port of BottomSheetScaffold for Material3
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@anchan828
anchan828 / README.md
Last active July 22, 2024 10:33
This is an improvement to allow @nestjs/[email protected] to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as [email protected].

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

@MrChocolatine
MrChocolatine / TS - More precise return type method Date#toISOString.d.ts
Last active October 25, 2024 10:42
TypeScript – How to accurately type dates in ISO 8601 format
// In TS, interfaces are "open" and can be extended
interface Date {
/**
* Give a more precise return type to the method `toISOString()`:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
*/
toISOString(): TDateISO;
}
type TYear = `${number}${number}${number}${number}`;
@oscarychen
oscarychen / python_on_mac_m1.md
Last active December 8, 2022 00:01
Setting up Python on Apple M1 (July 2021)

Setting up Python, XGBoost, Scipy on M1 Mac (July 2021)

As of July 2021, installing Python Xgboost on the M1 Macs is still confusing. The Python Xgboost library relies on Scipy, which requires a Fortran compiler, which is not available because GCC is not yet available for M1 (while Scipy does not support Flang). You may succeed in installing Python xgboost library without doing what I have described below and yet encounter issue running the library. I find the easiest thing currently is to just run Terminal with Rosetta, and go from there...

Get Terminal to run in Rosetta emulated X86 mode

  • Navigate to the Terminal app in Applications folder (sometimes it might be in Applications/Utilities)
  • Right click on the Terminal app -> Get Info -> Check Open using Rosetta
  • Optionally, you can duplicate the Terminal app, and rename the new one to something different, such as Terminal Rosetta and only make the duplicated app run in Rosetta mode

Install brew:

@eveningkid
eveningkid / react-native-shared-elements_facebook-marketplace.jsx
Created March 24, 2021 10:22
React Native Shared Elements: Facebook Marketplace Example
// Expo SDK40
// @react-native-community/masked-view: 0.1.10
// @react-navigation/native: ^5.9.3
// @react-navigation/stack: ^5.14.3
// react-native-gesture-handler: ~1.8.0
// react-native-reanimated: ~1.13.0
// react-native-safe-area-context: 3.1.9
// react-native-screens: ~2.15.2
// react-native-shared-element: 0.7.0
// react-navigation: 4
@daweido
daweido / user.controller.ts
Last active April 19, 2023 20:03
SMS OTP - Partial User authentification
import { Controller, Get, Res, HttpStatus, Body, Post } from '@nestjs/common';
import { User } from './interfaces/user.interface';
import { UserService } from './user.service';
@Controller('user')
export class UserController {
constructor(private userService: UserService) {}
@Post('/login')
async loginUser(
@chummypixels
chummypixels / renderSectionHeader.js
Last active August 23, 2023 08:50
renderSectionHeader in React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active November 16, 2024 17:43
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@drew-y
drew-y / pipe.ts
Created February 28, 2019 00:15
Simple TypeScript Pipe Pattern Implementation
interface Pipe<T> {
val: T;
into<U>(cb: (val: T) => U): Pipe<U>;
}
function pipe<T>(val: T): Pipe<T> {
return { val, into: cb => pipe(cb(val)) }
}
// // Example Usage