Skip to content

Instantly share code, notes, and snippets.

View lagagain's full-sized avatar

lagagain lagagain

View GitHub Profile
@lagagain
lagagain / ted_plugin.js
Created October 31, 2020 12:12
TED plugin
let block_keeper = document.querySelector("div.bg\\:white:nth-child(1) > div:nth-child(1) > div:nth-child(1)");
let video_region = block_keeper.firstChild;
block_keeper.style.height = "400px";
video_region.style.width = "700px";
video_region.style.position = "fixed";
video_region.style.zIndex = 1;
@lagagain
lagagain / .spacemacs
Last active January 2, 2021 06:06
spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@lagagain
lagagain / readme.md
Last active February 7, 2021 22:39
var/let/global 變數差異

無關鍵字賦值、var宣告、let宣告最大的差別在於生存區域的不同。

無關鍵字賦值 這意味著全域變數的宣告,當然你在全域範圍使用var/let宣告也是全域的。只是無關鍵字可能引發意外的情況,像是你預期變數應該是函數區域的:

function printG(){
  g = 1
  console.log(`printG: `, g)
}
@lagagain
lagagain / callme-1.js
Last active January 31, 2021 01:28
callme
call.exec = true;
call.toc = true;
call(callme, 1);
function callme(i) {
if (i < 0) return i;
console.log(i);
@lagagain
lagagain / maybe.js
Last active February 18, 2021 13:50
[javascript] Maybe / Box
function wrap(value){
switch(typeof value){
case 'number':
return new Number(value)
case 'string':
return new String(value)
case 'boolean':
return new Boolean(value)
case 'symbol':
@lagagain
lagagain / discovery\customer01\init.lua
Created October 5, 2025 06:04
【示範】擴充APISIX服務發現機制
local require = require
local local_conf = require('apisix.core.config_local').local_conf()
local http = require('resty.http')
local core = require('apisix.core')
local log = core.log
local ngx_timer_at = ngx.timer.at
local ngx_timer_every = ngx.timer.every
local debug = require("debug")
local default_weight