Skip to content

Instantly share code, notes, and snippets.

View KSXGitHub's full-sized avatar
🏠
Working from home

Khải KSXGitHub

🏠
Working from home
  • Earth, Solar System, Orion Arm, Milky Way
  • X @hvksmr1996
View GitHub Profile

Slayer's Testament I

In the first age, in the first battle, when the shadows first lengthened, one stood. Burned by the embers of Armageddon, his soul blistered by the fires of Hell and tainted beyond ascension, he chose the path of perpetual torment. In his ravenous hatred he found no peace; and with boiling blood he scoured the Umbral Plains seeking vengeance against the dark lords who had wronged him. He wore the crown of the Night Sentinels, and those that tasted the bile of his sword named him... the Doom Slayer.

Slayer's Testament II

Tempered by the fires of Hell, his iron will remained steadfast through the passage that preys upon the weak. For he alone was the Hell Walker, the Unchained Predator, who sought retribution in all quarters, dark and light, fire and ice, in the beginning and the end, and he hunted the slaves of Doom with barbarous cruelty; for he passed through the divide as none but demon had before.

const foo = require('./foo')
module.exports = () => foo()
@KSXGitHub
KSXGitHub / class-component.js
Last active February 1, 2018 06:17
Higher order component/function
class MyComponent extends React.Component {
render () {
const {Foo, Bar, children} = this.props
return <Foo hello='world'>
<Bar>{...children}</Bar>
</Foo>
}
}
# PACKAGES TO BE INSTALLED GLOBALLY
# $ pnpm install --global <pkg>@latest
global:
# Package Managers (Yarn is installed via pacman)
- npm
- pnpm
- lerna
- pnpm-package-group
# This project
.DS_Store
.out
.out.*
out
out.*
*.*.map
quick-test
quick-test.*

Foo

blah blah!

Bar

This is a link

console.log('Hello, World!!')
@KSXGitHub
KSXGitHub / javascript.js
Created January 14, 2018 08:45
Class-based OOP without "class" Raw
// base class
// - class is also constructor
// - private properties are local variables that are not exposed (true private)
// - public properties are object's properties
const Animal = (age, sex) => ({
greet: () => '',
getAge: () => age,
getSex: () => sex ? 'male' : 'female'
})
@KSXGitHub
KSXGitHub / cplusplus.cpp
Last active January 14, 2018 08:32
Class-based OOP without "class"
// base class
class Animal {
private:
// private property
int age;
bool sex;
public:
// constructor
Animal (int age, bool sex) {
@KSXGitHub
KSXGitHub / true.xml
Last active January 11, 2018 05:22
True XML
<?xml version="1.0" encoding="UTF-8" ?>
<xml>
<name>True XML example</name>
</xml>
const {catelogueNameValidation, activeStatusValidation} = formValidation
if (catelogueNameValidation || activeStatusValidation) return // Seriously, don't ever use 'null'
switch (submitType) {
case 'add':
this.props.postCatalogues(catelogue)
break
case 'edit':
this.props.updateCatalogues(_id, catalogue)