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
# coding: utf-8 | |
# In[14]: | |
import numpy as np | |
import pandas as pd | |
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot, plot | |
init_notebook_mode(connected=True) |
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
a = {1: -1, 2: -2} | |
b = {2: 2, 3: -3} | |
c = {3: 3, 4: -4} | |
d = {3: 3j, 5: -5} | |
def combine_dicts(*args): | |
"""Combines multiple dictionaries in one. Overwrites the value of keys if they occur in multiple dicts. | |
Value is taken from the """ | |
x = args |
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
private void CheckForNull<T, T2>(ref List<T> listOfObjs, ref params List<T2>[] otherLists) | |
{ | |
for (int i = listOfObjs.Count; i >= listOfObjs.Count; i--) | |
{ | |
var o = listOfObjs[i]; | |
if (o == null) | |
{ | |
listOfObjs.RemoveAt(i); | |
foreach (List<T2> otherList in otherLists) | |
{ |
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
// Doesn't work bcz ref and params doens't work. I now this was a concious decision by developers. | |
// This doesn't work. But it is kinda what 'pythonic'. | |
private void CheckForNull<T, T2>(ref List<T> listOfObjs, ref params List<T2>[] otherLists) | |
{ | |
for (int i = listOfObjs.Count; i >= listOfObjs.Count; i--) | |
{ | |
var o = listOfObjs[i]; | |
if (o == null) | |
{ | |
listOfObjs.RemoveAt(i); |
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 time | |
from healthcare import private_healthcare as healthcare # no going back after this. | |
import AI2IF | |
class AIDoc(object): | |
base_charge = 200 # admin fee | |
min_patient_wait_duration = 60 * 10 # in seconds. 10 min. | |
def check_patients(self, patient): | |
time.sleep(min_patient_wait_duration + random.randint(1, 6) * 60) |
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
# Example class | |
class Eg(object): | |
a = None | |
def __init__(self, a): | |
self.a = a | |
# look up dict to connect attribute to keys so I can get the relavent attr based on the key. | |
# issue is that it is easy to make mistake in string since there's no auto-complete and IDE checking. | |
# and obviously it's annoying to use. I |
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
using System; | |
namespace Scripts | |
{ | |
public class BaseProperty : Object | |
{ | |
public int myInt = 1; | |
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
/// <summary> | |
/// An abstract class which functions as string Enums. | |
/// Using it allows you to specify string value along with the usual int | |
/// for a enum option and convert between them. | |
/// It also allows you have potential string values. When converting to string | |
/// it will return the _stringRepresentation but any of the provided strings can | |
/// be used to convert from string to enum. | |
/// </summary> | |
/// <typeparam name="TEnum"></typeparam> | |
public abstract class StringEnumMap<TEnum> : IEnumerable<TEnum>, IComparable, IEquatable<TEnum> |
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
public class ContinueOnFailTest | |
{ | |
public struct MultiplyTestCase | |
{ | |
public int result; | |
public (int, int) input; | |
} | |
public int Multiply(int x, int y) => x * y; |
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
using System; | |
using System.Collections.Generic; | |
using System.Text.RegularExpressions; | |
using Newtonsoft.Json; | |
using Sirenix.OdinInspector; | |
using Sirenix.OdinInspector.Editor; | |
using UnityEditor; | |
using UnityEngine; |
OlderNewer