Skip to content

Instantly share code, notes, and snippets.

View chrisrng's full-sized avatar

Chris Ng chrisrng

View GitHub Profile
@chrisrng
chrisrng / components.my-component\.js
Last active June 4, 2020 15:34
isMessageBoxActive
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@tracked messageContent = '';
@tracked isFocused = false;
get isMessageBoxActive() {
return !!this.isFocused || !!this.messageContent;
@chrisrng
chrisrng / animating-ball.markdown
Created September 24, 2017 16:32
Animating Ball
@chrisrng
chrisrng / patent.js
Created March 6, 2017 05:02
Retrieves data from PatentsView.org API
const cache = {}
const bigNandlitteNcompanies = [
'Amazon Technologies, Inc.',
'Microsoft Technology Licensing, LLC',
'Apple Inc.',
'Facebook, Inc.',
'Google Inc.',
'LinkedIn Corporation',
'Uber Technologies, Inc.',
'Pinterest, Inc.',
function Longest(matrix) {
const cache = getMarkedUpMatrix(matrix);
let current = 1;
let longest = 1;
Object.keys(cache).map((value) => {
const cacheObj = cache[value];
const cacheObj2 = cache[(parseInt(value, 10) + 1) + ''];
if (isNeighbor(cacheObj, cacheObj2)) {
@chrisrng
chrisrng / hanoi.js
Last active February 16, 2016 14:40
Tower of Hanoi
(function(n) {
// DEFAULT to 5 if n is undefined
if (!n) {
console.log("DEFAULT to 5 if n is undefined");
n = 5;
}
var A = Array.apply(0, Array(n)).map(function(x, y){return y+1}).reverse();
var B = [];
var C = [];