Skip to content

Instantly share code, notes, and snippets.

View shihaohong's full-sized avatar

Shi-Hao Hong shihaohong

View GitHub Profile
@shihaohong
shihaohong / workingSampleTabBar.dart
Last active April 5, 2019 20:47
running implementation of behavior
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _TabBarContainer extends StatelessWidget {
@shihaohong
shihaohong / insertionSort.js
Created July 16, 2017 20:42
sorts an array in ascending order, taking into account the order of the numbers if the integer values matched
const insertionSort = function(array) {
// iterate through every element in the array
let temp;
for (let i = 1; i < array.length; i++) {
temp = array[i];
let j = i;
while (j > 0 && ( (array[j - 1].value > temp.value) || ( (array[j - 1].value === temp.value) && (array[j - 1].order > temp.order)) ) ) {
array[j] = array[j - 1];
j--;
}