Skip to content

Instantly share code, notes, and snippets.

View Zodiase's full-sized avatar

Xingchen Hong Zodiase

View GitHub Profile
@Zodiase
Zodiase / abs_vs_if.cs
Created February 3, 2016 06:45
Performance comparison between Math.Abs and conditional negation.
using System;
using System.Diagnostics;
namespace CsTests
{
class Program
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
@Zodiase
Zodiase / es6-abstract-class-example.js
Last active July 18, 2022 11:03
ES6 Abstract Class Example
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
@Zodiase
Zodiase / eztest.api.md
Last active February 27, 2016 10:58
This is a light weight tester for NPM.
@Zodiase
Zodiase / bind_vs_apply
Created February 29, 2016 12:45
Bind beats apply.
// Once bound, apply does nothing.
(function () {console.log(this.bar);}).bind({bar: true}).apply({bar: false});
// Output: true.
@Zodiase
Zodiase / rootUrlFix.js
Last active March 31, 2016 17:55
Meteor `rootUrl` fix.
/**
* @license
* Copyright 2016 Xingchen Hong
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@Zodiase
Zodiase / Tutorial.md
Last active December 28, 2020 19:24
How to: Get Eon Ticket for Omega Ruby & Alpha Sapphire on Nintendo 3DS.
  1. Fake a special Wi-Fi access point.
    1. The goal is to disguise your Wi-Fi access point to trick your 3DS into believing that it's in contact with some special Wi-Fi access points.
    2. The following steps are assuming using a Mac computer just because that's what I did. If you have some other devices, the overall process should be similar.
    3. Change the MAC address of your Wi-Fi card.
      1. Write down the original MAC address of the Wi-Fi card so you can restore it later. You could find the MAC address in your system report.
      2. Also find the network interface name of your Wi-Fi card. In my case that's "en1".
      3. Turn on your Wi-Fi so that the Wi-Fi card is powered on.
  2. Open Terminal, run sudo ifconfig en1 ether 4E:53:50:4F:4F:4C to change the MAC address of your Wi-Fi card.
@Zodiase
Zodiase / promise-example-parallel.js
Last active April 4, 2016 20:41
Examples of using Promise.
// Start from a Promise.
var foo = new Promise(function (resolve, reject) {
// Has to resolve to run callbacks in `.then()`.
resolve(1);
});
foo.then(function (result) {
// Received final resolve value from the Promise.
// result === 1;
console.log('result 1', result);
@Zodiase
Zodiase / 1.Starting-up.md
Last active April 11, 2016 23:48
Factorio Layout Examples

Minimal self-sustaining mining

image

Burner inserters will pickup coals to keep themselves running while supplying others.

@Zodiase
Zodiase / chase-text2csv.js
Last active June 20, 2016 17:05
Parse the text data from Chase Checking or Saving activities and save as a CSV file.
'use strict';
const nodePath = process.argv[0],
exePath = process.argv[1],
inputPath = process.argv[2],
fs = require('fs');
if (typeof inputPath === 'undefined') {
throw new Error('Need to specify input file path.');
}
@Zodiase
Zodiase / Dockerfile
Last active October 18, 2016 21:10
TerraRef BD Hyperspectral Extractor notes
# Dockerfile for the TerraRef hyperspectral image conversion extractor
# August 17, 2016
FROM ubuntu:14.04
MAINTAINER Yan Y. Liu <yanliu@illinois.edu>
# install common libraries and python modules
USER root
RUN apt-get update
RUN apt-get upgrade -y -q
RUN apt-get install -y -q build-essential m4 swig antlr libantlr-dev udunits-bin libudunits2-dev unzip cmake wget git libjpeg-dev libpng-dev libtiff-dev