This file contains hidden or 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
| (ns cursive-test.core | |
| (:require [clj-http.client :as client]) | |
| (:require [clojure.core.async :as async])) | |
| ; setup async pipelines | |
| (def publisher (async/chan)) | |
| (def publication | |
| (async/pub publisher #(:topic %))) |
This file contains hidden or 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
| module Sketch | |
| type Step = | |
| | VSI | |
| | BusinessAddress | |
| | Offer | |
| | AccountHolder | |
| | BusinessDetails | |
| | Identity | |
| | Concessions |
This file contains hidden or 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, { ChangeEvent } from "react"; | |
| import "./App.css"; | |
| import { RecoilRoot, atom, useRecoilState } from "recoil"; | |
| const useRecoilReducer = <S, A>( | |
| reducer: (s: S, a: A) => S, | |
| recoilState: any | |
| ) => { | |
| const [state, setState] = useRecoilState(recoilState); | |
| const dispatch = (a: A) => { |
This file contains hidden or 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
| type User = { name: string, email: string } | |
| type Admin = { name: string, role: string } | |
| // Let's say hi to a user! | |
| const greet1 = (u: User) => console.log(`Hi, ${u.name}`) | |
| // What if we want to greet an Admin though... We can't re-use this | |
| // What about taking a page out of C#'s book and use an interface? | |
| interface INamed { name: string } |
This file contains hidden or 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, { useReducer } from "react"; | |
| import { messages, initialMessagesState } from "./slices/messages"; | |
| const App: React.FC = () => { | |
| const [messageList, dispatch] = useReducer( | |
| messages.reducer, | |
| initialMessagesState | |
| ); | |
| return ( |
This file contains hidden or 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
| const fs = require('fs') | |
| const package = require('./package.json') | |
| const projectSettingsPath = 'ProjectSettings/ProjectSettings.asset' | |
| const re = /bundleVersion:\s(\d\.\d\.\d)$/gm | |
| const fileStr = fs.readFileSync(projectSettingsPath, 'utf8') | |
| const updated = fileStr.replace(re, `bundleVersion: ${package.version}`) | |
| console.log(`bundleVersion: ${package.version}`) |
This file contains hidden or 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
| type Lens<R, K extends keyof R, O> = { | |
| get(action: R):O, | |
| set(action: R, value:O): R | |
| } | |
| function lens<R, K extends keyof R, O>(field: K): Lens<R, K, O> { | |
| return { | |
| get(action: R): O { | |
| return (action[field] as unknown) as O | |
| }, |
This file contains hidden or 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
| function lens<K extends string>(key: K) { | |
| return <const>{ | |
| get: function<R extends any>(record: R): K extends keyof R ? R[K] : unknown { | |
| const k: string = key | |
| return record[k] | |
| }, | |
| set: function<R extends any>(record: R, value: R[K]) { | |
| return record.hasOwnProperty(key) ? | |
| { | |
| ...record, |
This file contains hidden or 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
| interface INamed<T> { | |
| name: T | |
| } | |
| export const Name = { | |
| get<T>(named: INamed<T>) { | |
| return named.name | |
| }, | |
| set<T>(named: INamed<T>, value: T) { | |
| return { |
This file contains hidden or 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
| void Update() | |
| { | |
| RaycastHit hit; | |
| Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
| if (Physics.Raycast(ray, out hit, 100, FloorLayer)) { | |
| Transform objectHit = hit.transform; | |
| if (SnapToGrid) { | |
| var newPos = new Vector3(Round(hit.point.x, GridSize), _yOffset, Round(hit.point.z, GridSize)); |