This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const UNASSIGNED = -1; | |
const ASSIGNED = 1; | |
class Board { | |
constructor(size, options) { | |
this.board = []; | |
this.size = size; | |
this.options = options; | |
for (let row = 0; row < size; row++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool Solve(configuration conf) { | |
if (no more choices) { // base case | |
return (conf is goal state) | |
} | |
for (all available choices) { | |
try one choice C: | |
// solve here, if it works, you're done | |
if (Solve(conf with choice C made) return true; | |
undo choice C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import get from 'lodash/get'; | |
/** | |
* Helper function to transform an array of objects to an object containing arrays, keyed by the common properties. | |
* This assumes that the array of objects have the same set of properties. | |
* | |
* Input: | |
* [{ size: 48,length: "L"}, {size: 42, length: "R'}] | |
* | |
* Output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import configureStore from "./store/configureStore"; | |
const store = configureStore(); | |
const rootEl = document.getElementById("root"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minikube stop; minikube delete && | |
docker stop $(docker ps -aq) && | |
rm -rf ~/.kube ~/.minikube && | |
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube && | |
launchctl stop '*kubelet*.mount' && | |
launchctl stop localkube.service && | |
launchctl disable localkube.service && | |
sudo rm -rf /etc/kubernetes/ && | |
docker system prune -af --volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"github.com/mongodb/mongo-go-driver/bson" | |
"github.com/mongodb/mongo-go-driver/mongo" | |
"github.com/mongodb/mongo-go-driver/mongo/options" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arp -na | grep -i b8:27:eb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function valOf(letter) { | |
const map = { | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, | |
'C': 100, | |
'D': 500, | |
'M': 1000, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global) { | |
// save references to native setTimeout() and clearTimeout() functions | |
const defaults = { | |
'setTimeout': global.setTimeout, | |
'clearTimeout': global.clearTimeout | |
}; | |
// create empty array to store timer IDs | |
const timeoutIds = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Working with branches | |
# | |
# Get the current branch name (not so useful in itself, but used in | |
# other aliases) | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# Push the current branch to the remote "origin", and set it to track | |
# the upstream branch | |
publish = "!git push -u origin $(git branch-name)" |