Skip to content

Instantly share code, notes, and snippets.

View sc1f's full-sized avatar

Jun Tan sc1f

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sc1f on github.
  • I am sc1f (https://keybase.io/sc1f) on keybase.
  • I have a public key ASAeTGMuo7LFaRt41JSsbUBoIbTZIB6CUZHSglRZUZeHYQo

To claim this, I am signing this object:

@sc1f
sc1f / .vimrc
Created December 7, 2021 19:27
default vimrc
syntax enable
filetype plugin on
filetype indent on
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set ignorecase
set smartcase
@sc1f
sc1f / README.md
Created November 3, 2021 15:10
Pushing a `dist` folder to GitHub pages without adding it to master

To push the contents of your dist folder to gh-pages, use the following steps:

  1. Make sure your branch to deploy gh-pages from is deleted on the remote. We'll be using the "pages" branch as an example.
  2. git checkout -b pages to create and checkout the new branch
  3. Edit your .gitignore to remove the ignore for dist
  4. git add -A to add all changes
  5. git commit your changes
  6. git subtree push --prefix dist origin pages - this will push the contents of dist to the pages branch, so that it only contains the contents of dist and nothing else from the repository/parent folders. This means that index.html will be at the root of the branch and you can select it to deploy immediately in your repo's options.
@sc1f
sc1f / toggle_viewer.js
Created September 8, 2021 12:34
Force all PerspectiveWidget configs to hide/show
%%javascript
// Select all PerspectiveWidget elements that are currently being displayed
const viewers = document.querySelectorAll("perspective-viewer");
// Toggle the config for each one. This can be made more complex to show and hide specific configs for specific viewers, etc.
for (const viewer of viewers) viewer.toggleConfig()
@sc1f
sc1f / index.html
Last active August 12, 2021 20:12
streaming
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script src="https://unpkg.com/@finos/perspective/dist/umd/perspective.js"></script>
<script src="https://unpkg.com/@finos/perspective-viewer/dist/umd/perspective-viewer.js"></script>
<script src="https://unpkg.com/@finos/perspective-viewer-datagrid"></script>
@sc1f
sc1f / index.html
Last active February 2, 2021 23:34
ExprTk Docs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exprtk docs</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<style>
body {
@sc1f
sc1f / index.html
Created July 28, 2020 22:07
Editable Superstore (Direct CDN Link)
<!--
Copyright (c) 2017, the Perspective Authors.
This file is part of the Perspective library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.
-->
<!DOCTYPE html>
@sc1f
sc1f / index.html
Last active July 28, 2020 22:06
Editable Perspective
<!--
Copyright (c) 2017, the Perspective Authors.
This file is part of the Perspective library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.
-->
<!DOCTYPE html>
const worker = perspective.worker();
worker._detect_transferable = () => {
worker._worker.transferable = false;
return false;
};
worker._detect_transferable();
const table = worker.table({
a: [1, 2, 3, 4]
});
<!--
Copyright (c) 2017, the Perspective Authors.
This file is part of the Perspective library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.
-->
<!DOCTYPE html>