Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Ng chrisrng

View GitHub Profile
View components.my-component\.js
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 / patent.js
Created Mar 6, 2017
Retrieves data from PatentsView.org API
View patent.js
const cache = {}
const bigNandlitteNcompanies = [
'Amazon Technologies, Inc.',
'Microsoft Technology Licensing, LLC',
'Apple Inc.',
'Facebook, Inc.',
'Google Inc.',
'LinkedIn Corporation',
'Uber Technologies, Inc.',
'Pinterest, Inc.',
View longest-consecutive-matrix.js
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 Feb 16, 2016
Tower of Hanoi
View hanoi.js
(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 = [];