Skip to content

Instantly share code, notes, and snippets.

View boyuanx's full-sized avatar

Jack Xu boyuanx

  • Sign
  • Irvine, CA
  • 19:13 (UTC -07:00)
  • X @headcpx
View GitHub Profile
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Calculator {
int256 mem;
constructor() {
mem = 0;
}
def q2():
print("SNAKE!")
print("SNAKE!", end="SNAAAAKE!\n")
print("This is for slice():", end=" ")
text = "Need for Speed: The Run is underrated."
print(text[slice(5)])
print(list(text))
print(text.split(":"))
@boyuanx
boyuanx / convert-arraybuffer.js
Created August 1, 2020 23:38 — forked from nuclearglow/convert-arraybuffer.js
ArrayBuffer <-> JSON <-> ArrayBuffer
// array buffer to JSON
const dataString JSON.stringify(Array.from(new Uint8Array(arrayBuffer)));
// send around
// JSON to ArrayBuffer
new Uint8Array(JSON.parse(dataString)).buffer
@boyuanx
boyuanx / home_container.dart
Created April 20, 2020 05:45 — forked from CaiJingLong/home_container.dart
flutter 懒加载 切换保持状态
class HomeContainer extends StatefulWidget {
final List<Widget> children;
final int currentIndex;
const HomeContainer({
Key key,
this.children,
this.currentIndex,
}) : super(key: key);
import 'package:flutter/material.dart';
class FadeIndexedStack extends StatefulWidget {
final int index;
final List<Widget> children;
final Duration duration;
const FadeIndexedStack({
Key key,
this.index,
@boyuanx
boyuanx / CSCI201_TomcatMacSetup.md
Last active January 22, 2023 12:17
Installing Tomcat on macOS with Homebrew

Lab 1: Tomcat Setup for macOS (UPDATED 2019.1)

Part 1: Install Homebrew

Homebrew is a package manager for macOS that enables you to install various software components and dependencies more easily.

To install Homebrew, go to their website: https://brew.sh

For your convenience, I have pasted the installation command in this document. However, they may make changes to it so if the following doesn't work, refer to Homebrew website.

@boyuanx
boyuanx / UIExtensions.swift
Last active June 22, 2018 16:35
Useful extensions for Swift 4
//
// UIExtensions.swift
//
// Created by Boyuan Xu on 5/5/18.
// Copyright © 2018 Boyuan Xu. All rights reserved.
//
// DISCLAIMER: I DO NOT CLAIM TO OWN THESE CODE SNIPPETS. HOWEVER, I HAVE RE-PURPOSED THEM FOR BETTER FUNCTIONALITY OR TO FIT MY NEEDS.
import UIKit