Skip to content

Instantly share code, notes, and snippets.

View primaryobjects's full-sized avatar

Kory Becker primaryobjects

View GitHub Profile
image = [
[1,1,1],
[1,1,0],
[1,0,1]
]
'''
|-------|
| 1 1 1 |
| 1 1 0 |
| 1 0 1 |
const capitalizeTitle = (title: string):string => {
let result:string = '';
let word:string = '';
for (let i=0; i<title.length; i++) {
if (title[i] !== ' ') {
// Append to current word.
word += title[i].toLowerCase();
}
else {
const maximumTime = time => {
const parts = time.split(':');
const hour = parts[0];
const minute = parts[1];
let hourMax;
if (hour[0] === '?') {
// ?X
// Determine if the first digit can be a 2 or 1.
if (hour[1] === '?') {
@primaryobjects
primaryobjects / mightandmagic7.md
Last active December 2, 2024 19:47
How to fix Might and Magic Heroes VII 7 crashing on startup

How to fix Might and Magic Heroes VII 7 crashing on startup

Might and Magic Heroes VII 7 may crash when trying to start the game in full screen mode. This can occur directly after the intro movie finishes playing, after which, the game crashes and you are returned to the desktop.

To fix the problem, change the game to use Windows Mode instead of full screen mode.

  1. Edit the file C:\Users\YOUR_USER_NAME\Documents\My Games\Might & Magic Heroes VII\MMH7Game\Config\MMH7SystemSettings.ini
  2. Under the section [SystemSettings] change or add the following entries:
public class Solution {
public int CountGoodSubstrings(string s) {
int result = 0;
for (int i=0; i<s.Length; i++)
{
if (i + 2 < s.Length)
{
// Check string starting at i and ending at i+2.
Dictionary<char, int> hash = new Dictionary<char, int>();
const checkValid = (matrix: number[][]):boolean => {
const width = matrix[0].length;
const height = matrix.length;
// Create a hash to remember values seen in the columns.
const colHash = [];
for (let i=0; i<width; i++) {
colHash.push({});
}
class Solution:
def canBeIncreasing(self, nums: List[int]) -> bool:
# We can only remove one value.
isRemoved = False
# Go through each value, starting at the second number.
for i in range(1, len(nums)):
# Check if the left value is greater than the current and we can still remove a value.
#print('Checking ' + str(nums[i-1]) + ' > ' + str(nums[i]))
if nums[i-1] >= nums[i] and not isRemoved:
public class Solution {
public int DistributeCandies(int[] candyType) {
Dictionary<int,int> hash = new Dictionary<int,int>();
int n = candyType.Length / 2;
// Collect the counts of candies.
for (int i=0; i<candyType.Length; i++)
{
if (hash.ContainsKey(candyType[i]))
{
@primaryobjects
primaryobjects / app.js
Last active March 11, 2022 21:07
How to check if debugging from within VS Code or the command-line. VSCode flag.
// Read command-line argument to indicate if running from VS Code.
const isVsCode = process.argv.slice(2).indexOf('--vscode') !== -1;
// Adjust base folder when running from within VS Code versus command-line.
var baseFolder = isVsCode ? 'some/directory' : 'directory';
// ...
public class Solution {
public string Int32ToString(int value, int toBase)
{
string result = string.Empty;
do
{
result = "0123456789ABCDEF"[value % toBase] + result;
value /= toBase;
}
while (value > 0);