Skip to content

Instantly share code, notes, and snippets.

View beyond-code-github's full-sized avatar

Pete Smith beyond-code-github

View GitHub Profile
@beyond-code-github
beyond-code-github / min-heap-range-four-lists.js
Created April 17, 2024 08:47
Use min-heap to find lowest range spanning four lists - Javascript
"use strict";
const Heap = require("heap")
const input = [
[3, 6, 8, 10 , 15],
[1, 5, 12],
[4, 8, 15, 16],
[2, 6]
]
@beyond-code-github
beyond-code-github / trie-heap-words.js
Created April 17, 2024 08:45
Basic Trie implementation and problem solve with Heap - Javascript
"use strict";
const Heap = require("heap");
class Trie {
count = 0;
key = null;
// each node stores a map to its child nodes
character = {};
@beyond-code-github
beyond-code-github / moch-karat-studio.js
Last active April 17, 2024 08:43
Mocha test boilerplate for Karat studio - Javascript
"use strict";
const Mocha = require('mocha');
const {describe, it} = Mocha;
const chai = require('chai');
const {assert} = chai;
chai.should();
@beyond-code-github
beyond-code-github / binary-tree-diameter.js
Created April 17, 2024 00:23
Calculate binary tree diameter in linear time - Javascript
"use strict";
class TreeNode {
data;
left;
right;
constructor(data) {
this.data = data;
@beyond-code-github
beyond-code-github / binary-tree-terse.js
Created April 17, 2024 00:01
Initialise a simple binary tree in a terse way - Javascript
"use strict";
class TreeNode {
data;
left;
right;
constructor(data) {
this.data = data;
@beyond-code-github
beyond-code-github / Examples.txt
Last active February 5, 2018 09:14
Pub name generator, simply wire in a function r that provides a random number (min, max) =>
"The King's Arms"
"The Three Dragons"
"The Wise Old Star"
"The George's Retreat"
"The Rising George"
"The Trout's Tavern"
"The Four Moons"
"The Bird's Arms"
"The Great Cross"
"The Angry Lion"
using System;
using System.Collections.Generic;
namespace OnlineShop
{
delegate decimal Discount(decimal amount, int yearsAccountHeld);
public static class Discounts
{
public static decimal NotRegistered(decimal amount, int yearsAccountHeld) => amount;
@beyond-code-github
beyond-code-github / teacherlist.html
Last active November 22, 2015 12:35
Teacher list after componentisation
<h1>List of teachers</h1>
<tablelist href="http://example.com/teachers">
<column id="notes"></column>
<column id="text"></columns>
</tablelist>
<bulkupload id="teacherUpload">
</bulkupload>

So you've learned to code... now what? Beyond code provides blog posts, podcasts, videos and training material to help you on your journey from entry level programmer to productive software development team member

Beyond Code is important because ultimately, making software is a 'people' business, and the social/personal aspects of a team are just as important as the tech.

@beyond-code-github
beyond-code-github / teacherscontroller.cs
Last active August 29, 2015 14:27
After refactoring, intent has simply been moved into the controller/model
public class TeachersController : ListController
{
protected override ListConfig Configuration
{
get
{
return new ListConfig()
{
ListTitle = "List of Teachers",
PostUrl = "api/teachers",