Skip to content

Instantly share code, notes, and snippets.

@Domiii
Domiii / JSFunStuff.md
Created June 20, 2020 07:48
JS in depth - odd behavior

When are chained callbacks in promises resolved?

Promise.then's "onFulfilledHandler" is called asynchronously. Meaning the callback will enter the queue for immediate execution after current stack fully unraveled. Calling 1000 then's takes a few milliseconds:

function f(x) {
    if (x > 0) {
        return Promise.resolve(--x).then(f);
    }
 console.timeEnd('f');
@Domiii
Domiii / TypingClubAutotyper.js
Last active November 25, 2025 03:42
This script types for you automatically on www.typingclub.com: 1. Open the website 2. Blaze past the tutorials 3. Go into a level 4. Open Console 5. Paste the script and press ENTER
/**
* This script types for you automatically on www.typingclub.com:
* 1. Open the website
* 2. Blaze past the tutorials
* 3. Go into a level
* 4. Open Console
* 5. Paste the script and press ENTER
*/
// NOTE: When delay (in ms between two strokes) is too low, the site might bug out and the result page will not be shown

『開發互動式網站 + 程式設計』的(社團模式的)營隊

走路走 100km 的概念~

  • 我們希望可以讓有興趣的同學
  • 慢慢往前進,不斷的有進展,就可以學會學到好~
  • 要快速衝的話,就會到第一個脈絡之前就沒力氣了~

TA

  • 已經知道想要投入的 高中生/大學生/大人為主 (很有投入度/很有好奇心/願意學習的國中生當然也可以~)
@Domiii
Domiii / 網站開發.md
Last active August 14, 2019 07:42
網站開發 - 紀錄(中文版)

開始學習網站開發的技術

  • JavaScript 的基礎
  • HTML + CSS 的基礎

在本機端專門開發網站的工具

  1. 前提:用終端機來控制電腦~ (英文關鍵字:terminal, command prompt)
  2. 如何在 Windows 上面打開 terminal?
--[[
Steps:
1. Use an editor to create a pixel map (e.g. https://www.piskelapp.com/)
1b. If your editor cannot export BMP files, use an online converter to generate a BMP file (e.g. https://image.online-convert.com/convert-to-bmp)
2. Convert BMP to Lua here: https://codepen.io/Domiii/pen/oMJvoJ?editors=0010
3. Copy the final Lua code to workspace.LevelPixels (ModuleScript)
4. Fix configuration below: make sure that colors map to blocks that have been prepared
5. Run this script!
@Domiii
Domiii / RealWorldTerrainRoblox.lua
Last active November 19, 2021 00:10
Import real world terrain into Roblox
--[[
Steps:
1. Download heightmap Bitmap
e.g. from terrain.party: http://terrain.party/api/export?name=guarda&box=10.186055,46.850130,10.080975,46.778264)
e.g. from earthe
Data Sets: NASA LPDAAC Collections -> NASA SRTM (SRTM 3) Collections
2. Use this site to convert BMP to Lua: https://codepen.io/Domiii/pen/oMJvoJ?editors=0010
3. Copy the final Lua code to workspace.TerrainPixels (ModuleScript)
4. Run this script!
@Domiii
Domiii / RepeatingBackground.cs
Created May 26, 2018 11:02
Simple horizontal repeating background in Unity (C#)
using UnityEngine;
using System.Collections;
/// <summary>
/// For this to work, you need a background sprite that is
/// 1) cyclical: it's left side connects seam-less with it's right side
/// 2) it must at least span the width of the camera view
/// 3) it must be repeated twice (so you actually have the same thing three times, implying at least three times the camera view width)
///
/// TODO: To make things simpler, you can just mirror a single sprite/texture and repeat it three times
package mouseclicks;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class RobotMouseTest {
static Robot bot;
public static void main(String[] args) throws Exception {
Thread.sleep(50);
@Domiii
Domiii / AddCustomEditorMenuItem.cs
Last active May 10, 2022 07:27
Adds a new "Add custom Editor" MenuItem to Script files in the Unity Project view. Explanation: https://stackoverflow.com/questions/50203145/shortcut-to-automatically-add-custom-editor-for-script-in-unity
/// Licensed under the Apache License, Version 2.0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text.RegularExpressions;
/**
* Spawns a stack of bricks
*/
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif