Skip to content

Instantly share code, notes, and snippets.

View MrZenW's full-sized avatar

ZenWANG MrZenW

View GitHub Profile
@MrZenW
MrZenW / Base64.lua
Created May 17, 2016 09:07 — forked from bortels/Base64.lua
Base64 encode/decode for Codea (Lua)
-- Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss <alexthkloss@web.de>
-- licensed under the terms of the LGPL2
-- character table string
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function enc(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@MrZenW
MrZenW / easing.js
Created December 12, 2019 01:47 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@MrZenW
MrZenW / SSL.md
Created July 16, 2020 02:56 — forked from gangsta/SSL.md
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr

Git clone all branches and push to a different remote

- 0x00 Initialisation -

Step 0x01 - add your own remote

# add another remote
git remote add mrzenw_github __ANOTHER_REMOTE_GIT_ADDRESS__HTTPS_OR_SSH__

Step 0x02 - create local branches as same as them in the origin repository

@MrZenW
MrZenW / how-to-delete-a-file-in-git-history.sh
Created August 30, 2022 12:18
If you can't push your repo to GitHub because of a large file in git history and you have even deleted it.
# https://stackoverflow.com/a/23657759
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD
@MrZenW
MrZenW / -how-to-configure-php-xdebug-with-docker-and-vscode.md
Last active September 8, 2022 04:08
How to configure PHP Xdebug with Docker and VSCode

How to Configure PHP Xdebug with Docker and VSCode

- File list -

  • Dockerfile
  • docker-compose.yml
  • mrzenw.nginx.conf
  • php.ini
  • xdebug.ini
  • .vscode/launch.json
@MrZenW
MrZenW / git-reset.md
Last active March 3, 2024 21:48
git-reset: The different ways to use git-reset
@MrZenW
MrZenW / TestReactDomCreatePortalTypeError.test.tsx
Last active April 6, 2023 02:01
Fix ReactDom.createPortal TypeError: parentInstance.children.indexOf is not a function
import { expect } from "@jest/globals";
import React, { ReactPortal } from "react";
import ReactDom from "react-dom";
import renderer from "react-test-renderer";
import { waitFor } from "@testing-library/react";
import * as componentModule from "./TestReactDomCreatePortalTypeError";
const { TestReactDomCreatePortalTypeError } = componentModule;
describe("Test ReactDom.createPortal TypeError: parentInstance.children.indexOf is not a function", () => {