'abcdefghijklmnopqrstuvwxyz'
.split('')
.map(x => { try { new RegExp('0', x); return x } catch { return false } } )
.filter(Boolean)
.join('')dgimsuy (sorted automatically)
| var computeDirSize = (list) => | |
| list.reduce((prev, curr) => { | |
| if (curr.type === "FOLDER") { | |
| return computeDirSize(curr.children) + prev; | |
| } else { | |
| return curr.value + prev; | |
| } | |
| }, 0) || 0; | |
| var readFile = file => ({ |
| type LoadedKey<Key extends string> = `is${Key}Loaded`; | |
| type SuccessKey<Key extends string> = `is${Key}Success`; | |
| type ErrorKey<Key extends string> = `is${Key}Error`; | |
| type LoadingKey<Key extends string> = `is${Key}Loading`; | |
| type Entity<Name extends string> = { | |
| [_ in LoadedKey<Name>]: boolean; | |
| } & { | |
| [_ in SuccessKey<Name>]: boolean; | |
| } & { |
| let ctx = document.createElement('canvas') | |
| document.body.appendChild(ctx) | |
| ctx.width = 500 | |
| ctx.height = 500 | |
| let gl = ctx.getContext('webgl') | |
| gl.viewport(0, 0, 500, 500) | |
| gl.clearColor(0.0, 0.0, 0.0, 1.0) | |
| export type PropsOf<P> = P extends React.ComponentType<infer T> ? T : P extends React.Component<infer T> ? T : never; |
| fn add( | |
| scope: &mut v8::HandleScope, | |
| args: v8::FunctionCallbackArguments, | |
| mut rv: v8::ReturnValue, | |
| ) { | |
| let first = match v8::Local::<v8::Number>::try_from(args.get(0)) { | |
| Ok(s) => s.value(), | |
| Err(_) => { | |
| let msg = v8::String::new(scope, "Invalid argument").unwrap(); | |
| let exception = v8::Exception::type_error(scope, msg); |
| const cycleValue = (value: number, cycleLength: number): number => { | |
| if (value > 0) return value % cycleLength; | |
| if (value < 0) return value + cycleLength; | |
| return 0; | |
| }; | |
| /** | |
| * Given a cycleLength, this hook will return a value that is | |
| * in the range of 0 and cycleLength. It also return methods to change |
| export const urlToImageFile = (url: string, { backgroundColor = '#000' }): Promise<File> => { | |
| const image = new Image(); | |
| const promise = new Promise<File>((resolve, reject) => { | |
| image.addEventListener('load', function () { | |
| const canvas = document.createElement('canvas'); | |
| canvas.width = this.width; | |
| canvas.height = this.height; | |
| const context = canvas.getContext('2d'); |
| export const svgToFile = (svg: SVGElement): Promise<File> => { | |
| const canvas = document.createElement('canvas'); | |
| canvas.width = Number(svg.getAttribute('width') || '0'); | |
| canvas.height = Number(svg.getAttribute('height') || '0'); | |
| const context = canvas.getContext('2d'); | |
| const xml = new XMLSerializer().serializeToString(svg); |
| string drilsGroupName = "Drills"; | |
| string mergeBlockTopName = "Merge Block (Top)"; | |
| string mergeBlockBottomName = "Merge Block (Bottom)"; | |
| string bodyPistonGroupName = "Pistons (Body)"; | |
| string drillPistonGroupName = "Pistons (Drill)"; | |
| string connectorsGroupName = "Connectors (Main)"; | |
| string rotorName = "Rotor Main"; | |
| struct DrillState { | |
| public float lastAngle; |