Skip to content

Instantly share code, notes, and snippets.

@jittuu
jittuu / send-email-via-scaleway.go
Created November 16, 2023 07:54
Send email using scaleway transactional emails
package main
import (
tem "github.com/scaleway/scaleway-sdk-go/api/tem/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/scw"
)
func main() {
// Read those from env
SCW_ACCESS_KEY := "SCW_ACCESS_KEY"
@jittuu
jittuu / BottomSheetFlashList.tsx
Last active March 16, 2023 10:35
BottomSheetFlashList
import React from 'react';
import {BottomSheetScrollView} from '@gorhom/bottom-sheet';
import {FlashList, FlashListProps} from '@shopify/flash-list';
type Props<T> = Omit<FlashListProps<T>, 'renderScrollComponent'>;
const BottomSheetFlashList = <T,>(props: Props<T>) => {
return (
<FlashList<T>
{...props}
@jittuu
jittuu / create_crud_user.sql
Last active July 7, 2022 06:59
Create APP CRUD user in Postgres
CREATE ROLE crud_user LOGIN PASSWORD 'thisissecretpassword';
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO crud_user;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO crud_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO crud_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT USAGE, SELECT ON SEQUENCES TO crud_user;
{
"go.toolsManagement.autoUpdate": true,
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.addTags": {
"options": "json="
},
"[go]": {
"editor.defaultFormatter": "golang.go",
@jittuu
jittuu / Map.tsx
Created January 29, 2021 09:13
React Native Map
import { isEqual } from 'lodash';
import React from 'react';
import { Dimensions, StyleSheet, ViewStyle } from 'react-native';
import MapView, { LatLng, MapViewProps, Marker, PROVIDER_GOOGLE } from 'react-native-maps';
interface P extends MapViewProps {
coordinate?: LatLng;
onChange?: (coordinate: LatLng) => void;
}
const { width } = Dimensions.get('window');
@jittuu
jittuu / mmNumber.ts
Created August 9, 2020 11:25
convert to Myanmar Number string
const _mmNumbers = {
'0': '၀',
'1': '၁',
'2': '၂',
'3': '၃',
'4': '၄',
'5': '၅',
'6': '၆',
'7': '၇',
'8': '၈',
@jittuu
jittuu / Dockerfile
Created July 2, 2019 07:34
Dockerfile for go web api
FROM golang:1.12 as builder
ADD . /app/api
WORKDIR /app/api
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -v -o api
FROM alpine
@jittuu
jittuu / QRCodeScanner.tsx
Created November 28, 2018 08:46
QR Code Scanner for React Native
import { debounce } from 'lodash';
import React from 'react';
import {
Dimensions,
StyleSheet,
TouchableOpacity,
View,
ViewStyle,
} from 'react-native';
import { BarCodeType, Point, RNCamera, Size } from 'react-native-camera';
@jittuu
jittuu / PhotoStateList.tsx
Created November 19, 2018 05:52
usage of FirebaseInfiniteFlatList
import React from 'react';
import {
Dimensions,
Image,
ListRenderItemInfo,
StyleSheet,
Text,
TouchableWithoutFeedback,
View,
ViewStyle,
@jittuu
jittuu / FirebaseInfiniteFlatList.tsx
Created November 19, 2018 05:44
Infinite FlatList with Firebase integration
import { throttle } from 'lodash';
import React from 'react';
import { ActivityIndicator, FlatList, ListRenderItem } from 'react-native';
import { RNFirebase } from 'react-native-firebase';
import { Subject, Subscription } from 'rxjs';
type Query = RNFirebase.firestore.Query;
type DocumentSnapshot = RNFirebase.firestore.DocumentSnapshot;
interface P<T> {