Skip to content

Instantly share code, notes, and snippets.

View nurmuhammadsirat's full-sized avatar

Nur Muhammad Sirat nurmuhammadsirat

View GitHub Profile
@nurmuhammadsirat
nurmuhammadsirat / Component.tsx
Last active May 23, 2023 08:58
React context pattern (typescript)
import { MyContextProvider } from './MyContextProvider;
import { SubComponent } from './SubComponent;
const Component = () => {
return (
<MyContextProvider>
<SubComponent> ... </SubComponent>
</MyContextProvider>
);
}
# Jump word back
option + left
Send escape sequence
b
# Jump word forward
option + right
Send escape sequence
const scrollBarStyle = `
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}
&::-webkit-scrollbar-track {
background: #f6f6f6;
border-radius: 8px;
}
&::-webkit-scrollbar-thumb {
@nurmuhammadsirat
nurmuhammadsirat / settings.json
Last active January 26, 2023 01:44
Windows Terminal settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "", // UUID of an application in the list below
"copyOnSelect": false,
"copyFormatting": false,
"profiles":
{
"defaults":
{},
@nurmuhammadsirat
nurmuhammadsirat / pre-push.sh
Last active November 25, 2020 09:00
Allow push to certain branches only
#!/bin/bash
allowed_branches=(develop branch2 branch3)
is_allowed=0
for i in ${!allowed_branches[@]};
do
branch=${allowed_branches[$i]}
if [[ "$branch" = "$(git rev-parse --abbrev-ref HEAD)" ]]
then
@nurmuhammadsirat
nurmuhammadsirat / mailcatcher.yaml
Created October 28, 2020 02:48
Mailcatcher K8S config
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: mailcatcher
spec:
replicas: 1
selector:
matchLabels:
app: mailcatcher
# This is the complete source code to Flappy Dragon:
# https://dragonruby.itch.io/flappydragon
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class FlappyDragon
attr_accessor :grid, :inputs, :game, :outputs
@nurmuhammadsirat
nurmuhammadsirat / docker-compose.yml
Created March 16, 2020 05:20
Need postgres server and client? I gotchu fam
version: '3.7'
services:
adminer:
image: adminer:latest
ports:
- "8080:8080"
postgres:
image: postgres:11.5
environment:
POSTGRES_DB: MY_DATABASE
// Put this whole file in __mocks__ folder as a sibling to __tests__
// In the xxxx.test.js, you can do an import 'mockAxios' from 'axios'
const mockAxios = jest.genMockFromModule("axios");
// @ts-ignore
mockAxios.create = jest.fn(() => mockAxios);
export default mockAxios;
eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c])}}return p}('2 3=5.4("d-e");2 c=5.4("b-f-d");2 a=5.4("b-g-h");7(2 i=0;i<3.6;i++){2 1=3[i];1.9.8(1)}7(2 i=0;i<c.6;i++){2 1=3[i];1.9.8(1)}7(2 i=0;i<a.6;i++){2 1=3[i];1.9.8(1)}',19,19,'|el|var|div1|getElementsByClassName|document|length|for|removeChild|parentNode|div3|paywall|div2|modal|backdrop|hard|fixed|popup|'.split('|')))