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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] |
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 { array, object, number, string, date, InferType } from "yup"; | |
import { Model } from "objection"; | |
// Shared | |
// Shared API data schema (objects shared between client and server) | |
export const sharedSchema = object({ | |
// none of these are required since not set until save (but they are also not nullable) | |
id: number() | |
.integer() | |
.notRequired(), |
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.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.XR.ARFoundation; | |
using UnityEngine.XR.ARSubsystems; | |
// This script is inspired by: | |
// https://www.youtube.com/watch?v=x08UU-I8eZ8&list=PLw3UgsOGHn4loDyxHG75eJxSnxxVgB-Yb&index=5&t=0s | |
// video Getting Started With ARFoundation in Unity (ARKit, ARCore): https://www.youtube.com/watch?v=Ml2UakwRxjk&list=WL&index=4 | |
[RequireComponent(typeof(ARRaycastManager))] |
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 { ActionMeta, ValueType } from "react-select"; | |
import CreatableSelect from "react-select/creatable"; | |
type CreatableMultiSelectProps = { | |
options: Set<string>; // available choices | |
values: Set<string>; // current selections | |
onChange: (values: Set<string>) => void; | |
}; |
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 math | |
values = [ | |
True, False, 1, 0, -1, "true", "false", "1", "0", "-1", "", None, math.inf, -math.inf, [], {}, [[]], [0], [1] | |
] | |
print("Truth Table") | |
print("-----------") | |
for value in values: | |
print(f"\t", end="") |
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
# 1. Clunky lambda syntax | |
numbers = [1, 2, 3] | |
# don't do this... | |
doubled = list(map(lambda n: n * 2, numbers)) | |
# There's no way to define the end of the block except that comma. What about wrapping lines? | |
# better for this case | |
doubled = [n * 2 for n in numbers] |
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
# on macOS, put this in ~/.config/flake8 | |
[flake8] | |
max-line-length=88 | |
ignore= | |
#E302 expected 2 blank lines, found 1 | |
E302, | |
#E261 at least two spaces before inline comment | |
E261, | |
# E401 multiple imports on one line | |
E401, |
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 multiprocessing, concurrent.futures | |
from functools import partial | |
WORKER_THREAD_COUNT = multiprocessing.cpu_count() | |
def parallelize(partials): | |
results = [] | |
with concurrent.futures.ProcessPoolExecutor(max_workers=WORKER_THREAD_COUNT) as executor: | |
jobs = [ executor.submit(p) for p in partials ] |
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
class NumericInput extends React.Component { | |
constructor(props = {}) { | |
super(props) | |
this.state = { | |
value: numeral(props.value).format('0,0') | |
} | |
} | |
onChange(e) { | |
var number = numeral().unformat(e.target.value) |
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 UIKit | |
import Braintree | |
let testToken = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJkODIwNjRmN2ZhZjExNWJiYTI5NjdmNGEwNmM2OWJhZjQxODVjYjJiZjg2NWNkYzRjNzRiZmIzMzdjNmU5MDMwfGNyZWF0ZWRfYXQ9MjAxNi0wNC0xMlQxNjowNzoyOS44MTc4NjgzNjYrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFs |
NewerOlder