Skip to content

Instantly share code, notes, and snippets.

View Becavalier's full-sized avatar
💅
Breaking through every day ...

Jason Yu Becavalier

💅
Breaking through every day ...
View GitHub Profile
@Becavalier
Becavalier / UglifyJS.TreeTransformer.js
Last active May 6, 2024 05:26
The basic usage of "UglifyJS.TreeTransformer".
const UglifyJS = require('uglify-js');
var symbolTable = {};
var binaryOperations = {
"+": (x, y) => x + y,
"-": (x, y) => x - y,
"*": (x, y) => x * y
}
var constexpr = new UglifyJS.TreeTransformer(null, function(node) {
if (node instanceof UglifyJS.AST_Binary) {
@Becavalier
Becavalier / v8.md
Created November 23, 2017 05:53 — forked from kevincennis/v8.md
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.bash_profile
    • Add export PATH=/path/to/depot_tools:"$PATH" (it's important that depot_tools comes first here)
@Becavalier
Becavalier / Parser.js
Created February 7, 2017 03:14 — forked from Saul-Mirone/MVVM.js
A simple mvvm
class Register {
constructor() {
this.routes = []
}
regist(obj, k, fn) {
const _i = this.routes.find(function(el) {
if((el.key === k || el.key.toString() === k.toString())
&& Object.is(el.obj, obj)) {
return el
@Becavalier
Becavalier / app.js
Created August 1, 2016 13:29 — forked from mshwery/app.js
Gulp + Browserify + requiring .html templates + Knockout web components
var ko = require('knockout');
ko.components.register('simple-name', require('./components/simple-name/simple-name.js'));
ko.applyBindings({ userName: ko.observable() });