Skip to content

Instantly share code, notes, and snippets.

View Kirkkt's full-sized avatar

Kirk Ke Tang Kirkkt

View GitHub Profile
@Kirkkt
Kirkkt / install-linux.sh
Last active February 28, 2020 10:14
Install and configure a fresh linux
sudo apt install git vim-gtk && \
mkdir ~/git && \
cd ~/git && \
git clone https://gitee.com/kirkkt/text-files-2019.git text-files && \
cd ~ && \
sh ~/git/text-files/bash/install-linux.sh
const clearScreen = () => {
const readline = require('readline')
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
}
const renderContent = (lines, highlightIndex, moveMode) => {
clearScreen()
@Kirkkt
Kirkkt / index.js
Created September 19, 2017 15:01
sg invite partners
const partners = [
{
"id": 1,
"urlName": "balance-at-work",
"organization": "Balance at Work",
"customerLocations": "across Australia, Pacific and Oceania",
"willWorkRemotely": true,
"website": "http://www.balanceatwork.com.au/",
"services": "At Balance at Work, we want to help you make work a joy for your employees and you! We specialize in leadership development, talent management and career coaching, and use Spidergap as one of our tools to help employees focus their development and achieve more.",
"offices": [
@Kirkkt
Kirkkt / index.js
Created September 19, 2017 14:59
sg deepClone
/*
Write a function called deepClone which takes an object and creates a copy of it. e.g. {name: "Paddy", address: {town: "Lerum", country: "Sweden"}} -> {name: "Paddy", address: {town: "Lerum", country: "Sweden"}}
*/
const deepClone = entity => {
if (entity === null) {
return null
}
if (entity instanceof Function) {
return entity
@Kirkkt
Kirkkt / array-flattener.js
Last active August 7, 2019 13:48
flatten an array of arbitrarily nested arrays of integers into a flat array of integers
/**
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com with your implementation.
When writing this code, you can use any language you're comfortable with. The code must be well tested and documented if necessary, and in general please treat the quality of the code as if it was ready to ship to production.
Try to avoid using language defined methods like Ruby's Array#flatten.*
*/
'use strict';
@Kirkkt
Kirkkt / js-array-flattener.js
Last active August 26, 2016 06:36
js-array-flattener
'use strict';
/**
* run `node flattenArray.js` in order to run the tests
*/
/**
* isDeepArray($array): returns whether $array is deep (containing subarrays):
* i.e.:
* [] -> false
@Kirkkt
Kirkkt / git diff ignoring certain files.md
Last active November 6, 2023 12:36
git diff ignoring certain files

git diff ignoring certain files

What is this?

Sometimes you want to ignore certain files when you run git diff, but you still want to check them in, which means you can't capitalize on .gitignore.

This guide is here to help.

How to set it up?