View complex_command_decorator.py
from typing import List | |
class CommandDecorator(): | |
def __init__(self, name: str = None, description: str = '', aliases: List[str] = list): | |
self.name = name | |
self.description = description | |
self.aliases = aliases | |
self.func = None | |
def __call__(self, func): | |
self.func = func |
View making-file-names-unique.java
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
class Solution { | |
HashMap<String, Integer> count = new HashMap<String, Integer>(); | |
public String[] getFolderNames(String[] names) { | |
String[] results = new String[names.length]; | |
for (int i = 0; i < names.length; i++) { |
View making-file-names-unique.java
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
class Solution { | |
public String[] getFolderNames(String[] names) { | |
Map<String, Set<Integer>> nameCount = new HashMap<String, Set<Integer>>(); | |
List<String> submit = new ArrayList<String>(names.length); | |
Pattern p = Pattern.compile("(.+)\\((\\d+)\\)"); | |
for (int i = 0; i < names.length; i++) { |
View infinite-error.py
class InfiniteError(Exception): | |
def __init__(self, func): | |
super().__init__("Oops!") | |
func() | |
def func(): | |
"""Very useful docstring. | |
Long enough so lemon approves. | |
""" | |
raise InfiniteError(func) |
View problems.js
import arithmetic from "@/arithmetic"; | |
import utils from "@/utils"; | |
export default { | |
methods: { | |
getProblem() { | |
console.log(this); | |
let problem = this.problems[utils.methods.getRandomInt(0, this.problems.length)]; | |
return problem.method(problem.difficulties[problem.current])(); | |
} |
View problems.js
import arithmetic from "@/arithmetic"; | |
import utils from "@/utils"; | |
export default { | |
methods: { | |
getProblem() { | |
console.log(this); | |
let problem = this.problems[utils.methods.getRandomInt(0, this.problems.length)]; | |
return problem.method(problem.difficulties[problem.current])(); | |
} |
View ChangeController.cs
/// <summary> | |
/// Move the ChangeController's current index forward by index. | |
/// Positive values only, wil only result in forward movement (if any). | |
/// </summary> | |
/// <param name="n">The number of times to move forward.</param> | |
public void Forward(int n = 1) { | |
if (n < 0) | |
throw new ArgumentOutOfRangeException(nameof(n)); | |
for (int i = 0; i < n; i++) { |
View Vector2Int.cs
// Decompiled with JetBrains decompiler | |
// Type: UnityEngine.Vector2Int | |
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | |
// MVID: 578B5B67-7E30-45F5-8675-3155BC1864CB | |
// Assembly location: C:\Program Files\Unity\Hub\Editor\2019.1.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll | |
using System; | |
using UnityEngine.Scripting; | |
namespace UnityEngine |
View Node.cs
public class Node { | |
public Node Parent; | |
public Vector2Int Position; | |
// A* Algorithm variables | |
public float DistanceToTarget; | |
public float Cost; | |
public float Weight; | |
public float F { |
View old_mechanum.java
double v1 = (radius * Math.cos(ang) + turnCon) * getMultiplier(); | |
double v2 = (radius * Math.sin(ang) - turnCon) * getMultiplier(); | |
double v3 = (radius * Math.sin(ang) + turnCon) * getMultiplier(); | |
double v4 = (radius * Math.cos(ang) - turnCon) * getMultiplier(); | |
robot.motorLeftFront.setPower(v1); | |
robot.motorRightFront.setPower(v2); | |
robot.motorLeftRear.setPower(v3); | |
robot.motorRightRear.setPower(v4); |
NewerOlder