Skip to content

Instantly share code, notes, and snippets.

View Oskang09's full-sized avatar
💻
Keep working hard ...

NG SZE CHEN Oskang09

💻
Keep working hard ...
View GitHub Profile
@Oskang09
Oskang09 / ActionListener.java
Last active July 7, 2021 05:46
Minecraft FightAPI Listener
package me.oska.cf.listener;
import me.oska.cf.CustomFight;
import me.oska.cf.event.enums.DamageType;
import me.oska.cf.util.Invoker;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@Oskang09
Oskang09 / hostlan.sh
Created January 12, 2019 10:27
Local Area Network Setup Bash
#!/bin/bash
printf "Setting up for Local Hosted Network\n\n"
interface_name=`iw dev | awk '$1 == "Interface"{print $2}'`
printf "=======================\n"
printf "Wifi Interface Name: \n";
count=1;
for i in $(echo $interface_name | tr ";" "\n");
@Oskang09
Oskang09 / devices.scss
Created April 2, 2019 08:00
Media query using SASS
/*
Sample Usage
- device(mobile-small)
>> @media ( min-width: 320px, max-width: 375px )
- smaller_device(mobile-small, min)
>> @media ( max-width: 375px )
- smaller_device(mobile-large, mobile-small)
@Oskang09
Oskang09 / Docs.md
Last active April 3, 2019 09:53
Lazy Syntax for Sequelize Migration

Lazy Syntax

Lazy syntax is for migration pattern for migrate models to database. They have their own code just for lazy purpose created this so named it lazy sytnax. Current features have priority and error handling.

Example lazy syntax migration pattern
migrations:
    {
        ['1-clean-startup']: // migration file_name
        {
@Oskang09
Oskang09 / HolidayAPI.cs
Last active May 17, 2019 02:04
C# Holiday API , Web crawler
using CSharpOskaAPI.Error;
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace HaoProgram_Rebuild.calendar
@Oskang09
Oskang09 / LoadableAttributes.md
Last active May 28, 2019 07:14
LoadableAttributes used at Querying

Loadable Attributes

As we know preload & postload for DataObject transforming is important, with this advantages i have implement data loader concept from graphQL. Batch Loader is a factory method for handle all of the keys, required attributes or querying and combine them all into one non-redundant query.

Related site:

Example we have 3 tables, posts, comments and users and we want to get data as below given.

@Oskang09
Oskang09 / react-async-provider.js
Last active November 9, 2021 14:57
Async Provider Components
import React from 'react';
import PropTypes from 'prop-types';
const AsyncContext = React.createContext();
AsyncContext.displayName = 'AsyncContext';
class AsyncProvider extends React.Component {
static propTypes = {
promise: PropTypes.object,
@Oskang09
Oskang09 / README.md
Last active December 21, 2019 16:50
golang dataloader

Description

Utility function for building data loader for loading repeating data in relational. There still many other use case.

Explaination

DataLoader is a generic utility used to abstract request batching and caching. It use to solve N+1 Problem when using with data loading. BatchLoader taking all of the required keys when preload and postload return the data to the stack where we call.

Example Populating Data

@Oskang09
Oskang09 / example.js
Last active December 19, 2019 08:58
支付宝小程序 Code Style 样本
const App = getApp();
Page({
data: {
// data decleration 应该放上面,方便进来查看变数的时候直接看得到
},
async fetchStore() {
// 处理API 并且获取data, 和处理 error handling 之类的
return data;
},
@Oskang09
Oskang09 / readme.md
Created December 21, 2019 14:53
Git naming conventions

Git Naming Convention

  • Branch naming convention
    • master (production code)
    • sandbox (staging code)
    • develop (development code)
    • feature/XXX
    • release/XXX
    • hotfix/XXX