Skip to content

Instantly share code, notes, and snippets.

View tawanorg's full-sized avatar
🎯
Focusing

Tew Tawan tawanorg

🎯
Focusing
View GitHub Profile
@tawanorg
tawanorg / page-info.ts
Created January 31, 2023 07:44 — forked from tumainimosha/page-info.ts
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@tawanorg
tawanorg / loadRemoteContainer.ts
Created November 15, 2022 07:59
loadRemoteContainer
export type ResolveRemoteUrlFunction = (
remoteName: string
) => string | Promise<string>;
declare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;
declare const __webpack_share_scopes__: { default: unknown };
let resolveRemoteUrl: ResolveRemoteUrlFunction;
export function setRemoteUrlResolver(
@tawanorg
tawanorg / Dockerfile
Created May 5, 2022 13:46
tawanorg/ubuntu
FROM ubuntu:18.04
LABEL maintainer="Tew Tawan <[email protected]>"
# Replace shell with bash so we can source files
# Set the SHELL to bash with pipefail option
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ENV NODE_VERSION v14
@tawanorg
tawanorg / clean_node_modules.sh
Created July 31, 2021 17:52 — forked from zephraph/clean_node_modules.sh
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted
SEARCH_PATH="./Git" # Update this to the path where your code is stored
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
@tawanorg
tawanorg / top-brew-packages.txt
Created November 23, 2020 11:21 — forked from pmkay/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
python: Interpreted, interactive, object-oriented programming language
mysql: Open source relational database management system
coreutils: GNU File, Shell, and Text utilities
openssl: SSL/TLS cryptography library
postgresql: Object-relational database system
@tawanorg
tawanorg / ProgressiveImgLoader.js
Created July 3, 2020 04:26 — forked from knee-cola/ProgressiveImgLoader.js
simple progressive texture image loader for Three.js
/**
* @author knee-cola / https://github.com/knee-cola
* Original file URL: https://gist.github.com/knee-cola/37875bc4359609b96c9f329cd2a68fa1
*/
// This is a simple progressive image loader for Three.js
// It enables the smaller image files to be loaded first,
// before the big texture image is fully loaded.
//
// The images are loaded in the order they are passed
@tawanorg
tawanorg / machine.js
Created June 9, 2020 22:15
Generated by XState Viz: https://xstate.js.org/viz
const invokeFakeResolvedAuthApi = () => {
return Promise.reject("tim");
};
const authServerMachine = Machine({
id: "server",
initial: "waitingForCode",
context: {
user: null
@tawanorg
tawanorg / AppDelegate.m
Created April 1, 2020 01:05 — forked from Jpoliachik/AppDelegate.m
ReactNative iOS Launch Screen No Flash
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. init window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
// 2. backgroundView using LaunchScreen.xib
UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject];
backgroundView.frame = self.window.bounds;
@tawanorg
tawanorg / bootstrap-mq.scss
Created April 4, 2019 13:18 — forked from olegpolyakov/bootstrap-mq.scss
Bootstrap Sass Media Query Variables
//== Media queries breakpoints
// Extra small screen / phone
$screen-xs: 480px;
$screen-xs-min: $screen-xs;
// Small screen / tablet
$screen-sm: 768px;
$screen-sm-min: $screen-sm;
@tawanorg
tawanorg / __responsive styled components
Created July 23, 2018 11:09 — forked from granmoe/__responsive styled components
Programmatically create responsive styled components with react and styled-components
// this file is just here to change the name of the gist
import React from 'react'
import styled from 'styled-components'
const makeResponsiveComponent = (rulesets, tagName = 'div') =>
styled(tagName)`${buildStyles(rulesets)}`
const buildStyles = rulesets =>
rulesets.reduce(
(cssString, { constraint, width, rules }) =>