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, { ComponentProps, ReactElement } from 'react' | |
| //React extends the web all of these ways! | |
| // interface InputProps extends React.HTMLProps<HTMLInputElement>{ | |
| // icon?: string | |
| // } | |
| // interface InputProps extends ComponentProps<"input"> { | |
| // icon?: 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
| useEffect(() => { | |
| async function fetchServerGeneratedValue() { | |
| try { | |
| const response = await fetch('http://localhost:5000', { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| }, | |
| }); | |
| const json = await response.json(); |
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
| rules: [ | |
| { | |
| name: 'xorWithAllPaths', | |
| params: {peers: Joi.array()}, | |
| validate(params, value, state, options) { | |
| if (value !== null && params) { | |
| const xOrError = Joi.object() | |
| .keys({discountAmount: Joi.number(), discountPercentage: Joi.number()}) | |
| .xor('discountAmount', 'discountPercentage') | |
| .options({allowUnknown: true}) |
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
| <!-- solution #1 --> | |
| <!-- Solution #1 - Do not destory activity when device rotates --> | |
| <!-- When to use solution #1? When activity does NOT need different resource files/layouts based on device rotation. | |
| Usually only an option when having simple interface that doesn't vary greatly by screen size or orientation. --> | |
| <application> | |
| <activity | |
| android:name=".activity.Solution1Activity" | |
| android:configChanges="orientation|keyboardHidden|screenSize" | |
| > <!-- tells Android activity will define consequences of these config changes & not to carry out default behaviors --> |
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
| .bottom{ | |
| position: absolute; | |
| bottom: 0; | |
| right: 0; | |
| left: 0; | |
| } |
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
| // Custom checkbox | |
| // | |
| // Requires checkbox type input with sibling label having the 'for' attribute | |
| // The label appears as the checkbox, while the real/orginal checkbox isn't displayed | |
| // Unicode is used for checkmark representation | |
| .input-checkbox-variant(@color; @background; @border; @size){ | |
| input[type='checkbox']{display: none;} | |
| input[type='checkbox'] + label{ | |
| height: @size; |
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
| // Custom checkbox | |
| // | |
| // Requires checkbox type input with sibling label having the 'for' attribute | |
| // Relies on TWBS label display setting of 'display: inline-block;' | |
| // The label appears as the checkbox, while the real/orginal checkbox isn't displayed | |
| // Unicode is used for checkmark representation | |
| .input-checkbox-variant(@color; @background; @border; @size) | |
| when (get-unit(@size) = rem), (get-unit(@size) = em){ | |
| input[type='checkbox']{display: none;} |
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
| [ | |
| ['shop',[{ request: request, callback: callback}, {request: request, callback: callback}]] | |
| ,['drink',[{}, {}]] | |
| ,['eat',[{}, {}]] | |
| ] |
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
| //anonymous immediately invoked function expression | |
| //module pattern with anonymous closures | |
| var WEBCOLOR = (function(){ | |
| //private, closed up into WEBCOLOR namespace | |
| var white = 0; | |
| var black = 255; | |
| //private (not exposed via namespace | |
| var func = function(var){ |
NewerOlder