Skip to content

Instantly share code, notes, and snippets.

View naramdash's full-sized avatar
🚲
Keep Studying & Working

김주호 naramdash

🚲
Keep Studying & Working
View GitHub Profile
@naramdash
naramdash / Pagination.js
Last active July 7, 2020 10:23
React Fluent UI Pagination using Javascript & Fluent-UI
import React, { useMemo } from 'react';
import {
Stack,
Pivot,
PivotItem,
PivotLinkFormat,
IconButton,
} from '@fluentui/react';
function range(start, stop, step) {
@naramdash
naramdash / DIY_check_token_value.js
Last active July 2, 2020 05:29
AWS Amplify refreshSession (id: new, access: new, refresh: same)
async function refresh() {
const { idToken, accessToken, refreshToken } = await Auth.currentSession();
console.log('id: ', idToken.jwtToken);
console.log();
console.log('access: ', accessToken.jwtToken);
console.log();
console.log('refresh: ', refreshToken.token);
console.log();
try {
@naramdash
naramdash / Pagination.tsx
Last active July 7, 2020 10:23
React Material-UI Pagination Component with Displayed-Page-Range style using Typescript & Material-UI
import React, { useMemo, FC } from 'react'
import { Box, Button, makeStyles } from '@material-ui/core'
import { SkipPrevious, SkipNext, NavigateBefore, NavigateNext } from '@material-ui/icons'
import classnames from 'classnames'
function range(start: number, stop: number, step: number) {
return Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step)
}
interface PaginationParams {
@naramdash
naramdash / aws_config.js
Last active August 20, 2020 03:47
Upload image to S3 in React + Typescript
import Amplify, { Auth, Storage } from 'aws-amplify';
Amplify.configure({
Auth: {
identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', //REQUIRED - Amazon Cognito Identity Pool ID
region: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region
userPoolId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito User Pool ID
userPoolWebClientId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito Web Client ID
},
Storage: {
@naramdash
naramdash / sliceToSmallArray.js
Last active September 17, 2020 12:34
split array to small array with maxLength
function sliceToSmallArray(acc, arr, maxLength) {
if (arr.length === 0) return acc
if (arr.length <= maxLength) return [...acc, arr]
return sliceToSmallArray([...acc, arr.slice(0, maxLength)], arr.slice(maxLength), maxLength)
}
@naramdash
naramdash / fsharpjobs.md
Created August 27, 2021 02:05 — forked from swlaschin/fsharpjobs.md
My suggestions on how to look for F# jobs

How to find F# jobs

People often ask me how to find F# jobs. I don't have any special connections to companies using F#, and I don't have any special tricks either. I wish I did!

So, given that, here's my take on F# jobs.

Job hunting

For job hunting my suggestions are:

@naramdash
naramdash / Vagrantfile
Last active October 17, 2021 15:56
Vagrantfile sample
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.define "control-plane" do |config|
config.vm.box = "generic/rocky8"
@naramdash
naramdash / makeObjectFunctionsProxy.ts
Last active July 13, 2022 06:32
Function proxies for Logging
function getParams(func: Function) {
// String representaation of the function code
const funcS = func.toString()
// Remove comments of the form /* ... */
// Removing comments of the form //
// Remove body of the function { ... }
// removing '=>' if func is arrow function
const str = funcS
.replace(/\/\*[\s\S]*?\*\//g, '')
# Boot oh-my-posh
# must install oh-my-posh
# https://ohmyposh.dev/docs/windows
# oh-my-posh prompt init pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json | Invoke-Expression
oh-my-posh prompt init pwsh --config "~/Documents/PowerShell/.mytheme.omp.json" | Invoke-Expression
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
@naramdash
naramdash / .mytheme.omp.json
Created March 17, 2022 04:25
my oh-my-posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"foreground": "#007acc",
"properties": {
"template": "{{ .Name }}"