Skip to content

Instantly share code, notes, and snippets.

🏐
Focusing

Operations Research Engineering Software+ ORESoftware

🏐
Focusing
Block or report user

Report or block ORESoftware

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ORESoftware
ORESoftware / bfs.js
Last active Apr 12, 2019
Simple breadth first traversal example
View bfs.js
'use strict';
const queue = [];
const root = {};
const main = {
name: 'main',
linkedSet:{
a: {
name: 'a',
@ORESoftware
ORESoftware / client.md
Last active Mar 19, 2019
Python swallows an error
View client.md

Run this container (it's a server):

docker run -p 6970:6970 -it oresoftware/live-mutex-broker:latest

then run this python script with Python 3.6.7:

@ORESoftware
ORESoftware / domain.md
Created Dec 16, 2018
Simple use cases for Node.js domain module
View domain.md

First run this code:

const exec = () => {
   setTimeout(() => {
      throw 'nothing can catch this, except domains';
   },10);
};
@ORESoftware
ORESoftware / promises.ts
Last active Mar 11, 2019
promise api technique
View promises.ts
export class Worker {
getLock(v: string, cb: Function){
this.getLockInternal(v,cb);
}
getLockp(v:string){
return new Promise((resolve,reject) => {
this.getLockInternal(v, (err,result) => {
@ORESoftware
ORESoftware / xml-question.md
Last active Feb 28, 2019
Standard way to tell XML parsers that child is a singleton as opposed to a list
View xml-question.md

Say we have this XML

<bookstore>
  <book>art of war</book>
</bookstore

Most bookstores have many books, so we'd probably be right to assume that books is a list.

View null.9.ts
const passAStringOrNull = (v: StringOrNull) => {
let input: String;
if(v == null){
input = "default string";
}
else {
input = v;
}
return goDoDatabaseStuff(input);
View null.8.ts
const passAStringOrNull = (v: StringOrNull) => {
if(v == null){
v = "default string";
}
return goDoDatabaseStuff((String)v);
}
View null.7.ts
const goDoDatabaseStuff = (v: String) => {
return doWhatever();
}
View null.6.ts
const passAStringOrNull = (v: StringOrNull) => {
return goDoDatabaseStuff(v);
}
View null.5.ts
const getAStringOrNull = (v: Object) : StringOrNull => {
return v === bar ? v.toString() : null;
};
You can’t perform that action at this time.