Skip to content

Instantly share code, notes, and snippets.

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

scott1028

🏠
Working from home
View GitHub Profile
@scott1028
scott1028 / getRemoteFilesByFtp.js
Last active March 24, 2024 15:55
getRemoteFilesByFtp.js
const fs = require('fs');
// https://github.com/mscdex/node-ftp
const ftp = require('ftp');
/**
* fishing rod(chatGPT): https://chat.openai.com/share/f45faeb4-13a1-4221-b98f-9a1428d694a4
*/
// Configuration for the FTP server
const ftpConfig = {
@scott1028
scott1028 / dom_performance_reflow_repaint.md
Created June 14, 2023 02:15 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@scott1028
scott1028 / index.html
Created April 30, 2023 04:47
WIP: POC: JS Scrollbar Wheel or Moving animation smoonthly by requestAnimationFrame
<pre>
scroll smoonthly: https://stackoverflow.com/questions/47011055/smooth-vertical-scrolling-on-mouse-wheel-in-vanilla-javascript
</pre>
<hr />
<div id="root"></div>
@scott1028
scott1028 / getDynamicalMapper.js
Last active March 5, 2023 12:13
Dynamical mapper generator by pre-defined template path
const _ = require('lodash');
const template = {
questionnaireIdToQuestionSeq: {
'$sections.0.questionData.id$': '01',
v: {
'$aaaa.bb.cc$': {
'$nn.qq.aa$': [
'$sections.0.questionData.id$',
'$sections.0.questionData.id$',
@scott1028
scott1028 / sheet_to_json.js
Last active January 6, 2023 12:00
help function for xlsx to resolve extra excel file blocking issue
const _ = require('lodash');
const xlsx = require('xlsx');
const sheet_to_json = (sheet, headerRowIndex = 1, map = v => v) => {
const filteredData = _.toPairs(sheet).filter(([, value]) => value.hasOwnProperty('w'));
const dataMap = _.fromPairs(filteredData);
const columnKeys = [];
let totalRows = 0;
filteredData.forEach(([key]) => {
const { columnKey, rowKey } = /(?<columnKey>[A-z]+)(?<rowKey>\d+)/.exec(key).groups;
@scott1028
scott1028 / versioningKeyValueStore.js
Last active July 12, 2021 23:51
TEST-02: time based versioning KeyValue store
/* TEST-02
A simple version key value store mechanism
NOTE: here is the example about I will use this store instance.
const store = new Store();
store.put('scott', 1); // => 10000
store.put('scott', 2); // => 10010
store.put('scott', 3); // => 10020
store.get('robert', 9999); // => null
@scott1028
scott1028 / InputAndBackspaceCheck.js
Last active July 12, 2021 23:30
TEST-01: Input String
```js
/*
to input string with some particular character which is treated as "backespace" and caculate the final output.
ex: `112233###5566#` => `112556`
ex: `####1122#33` => `11233`
ex: `11########` => ``
*/
function main(value) {
@scott1028
scott1028 / demo-animated-verbs-by-splitting-js.markdown
Created September 14, 2019 15:27
Demo Animated Verbs By `splitting.js`
@scott1028
scott1028 / Howl's Moving Castle.markdown
Last active December 30, 2019 04:29
Howl's Moving Castle

Howl's Moving Castle

This is a tribute to Studio Ghibli's Exhibition in Paris.

While walking through the exhibit, I learned that the castle in howl's moving castle was actually animated with a computer. I was surprised, and inspired to recreate this famous scene using web technologies that I'm familiar with, allowing the user to control the castle's movement.

I ended up biting off more than I could chew, and spending much longer than I had initially intended.

To achieve it, I cut all of the elements out of the film itself using photoshop to crop certain frames. I then inserted all of the elements directly to the DOM (no canvas) and animated them using GSAP and an epic amount of timelines. The legs' walk cycle were by far the most difficult part. I did not use any other software for the animation, just good old sublime text!

Ionic - Back Button In Tabs

Attempting to get Tabs view to show back buttons or at least "left-buttons"

A Pen by Justin Noel on CodePen.

License.