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
| typedef struct Q { | |
| int val; | |
| int sp; | |
| int time[20000]; | |
| struct Q* left; | |
| struct Q* right; | |
| } Q; | |
| Q* qCreate(int val, int time) { | |
| Q* q = malloc(sizeof(Q)); |
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
| #!/bin/sh | |
| for ARG in $@; do | |
| # extract service name and pid file path | |
| NAME=`echo $ARG | cut -d":" -f1` | |
| PID_PATH=`echo $ARG | cut -d":" -f2` | |
| if [ "$NAME" = "$PID_PATH" ]; then | |
| PID_PATH="$PID_PATH.pid" | |
| fi | |
| # check service status |
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 SetStateAction<S> = S | (prevState: S) => S; | |
| export const isStateTransition = <S>( | |
| x: SetStateAction<S> | |
| ): x is StateTransition<S> => { | |
| return typeof x === "function"; | |
| }; | |
| export const tapStateAction = <S>( | |
| s: SetStateAction<S>, |
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
| --- /etc/cloud/cloud.cfg 2019-09-12 07:42:33.236106056 +0000 | |
| +++ /etc/cloud/cloud.cfg.dpkg-new 2021-05-11 17:22:24.000000000 +0000 | |
| @@ -12,7 +12,7 @@ | |
| disable_root: true | |
| # This will cause the set+update hostname module to not operate (if true) | |
| -preserve_hostname: true | |
| +preserve_hostname: false | |
| # Example datasource config |
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 Option<T> = T | undefined; | |
| type Parser<T> = (input: string) => [Option<T>, string]; | |
| const alt | |
| : <T>(pa: Parser<T>, pb: Parser<T>) => Parser<T> | |
| = (pa, pb) => (input) => { | |
| const result = pa(input); | |
| if (result[0] !== undefined) return result; | |
| return pb(input); | |
| }; |
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 HIDDEN_STYLE = ` | |
| height:0 !important; | |
| visibility:hidden !important; | |
| overflow:hidden !important; | |
| position:absolute !important; | |
| z-index:-1000 !important; | |
| top:0 !important; | |
| right:0 !important | |
| `; |
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 g(a: number[], p: (x: number) => boolean) { | |
| let i; | |
| for (i = 0; i < a.length; ++i) { | |
| if (p(a[i])) return i; // early return | |
| } | |
| return i; | |
| } | |
| // 有限制 |
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
| use crate::arith::syntax::*; | |
| use Term::*; | |
| pub fn eval1(term: Term) -> Term { | |
| match term { | |
| // E-IfTrue | |
| If(box True, box t1, _) => t1, | |
| // E-IfFalse | |
| If(box False, _, box t2) => t2, | |
| // E-If-Wrong |
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 { | |
| Term, | |
| tru, | |
| fal, | |
| cond, | |
| succ, | |
| pred, | |
| isZero, | |
| wrong, | |
| } from '../syntax'; |
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, { FC } from 'react'; | |
| import * as Inter from 'interaction'; | |
| export default const Foo: FC<Inter.ListProps<[string, number, string]>> = ({ value, onChange }) => { | |
| return ( | |
| <Inter.List value={value} onChange={onChange}> | |
| <Inter.Text /> | |
| <p>foobar</p> | |
| <Inter.Number /> | |
| <Inter.Text /> |