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 { | |
Form, | |
FormGroup, | |
TextInput, | |
SubmitButton, | |
DefaultTemplate, | |
} from "@arcnovus/wet-boew-react"; | |
import { MultiCheckboxSelect } from "../../components/MultiCheckboxSelect"; | |
export default function FormExample() { |
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
/** | |
* Lets WET-BOEW know about a new component that was added to the page so that | |
* WET-BOEW can apply the WET-BOEW JavaScript to it. | |
* | |
* @param {string} selector an HTML selector, usually the class | |
* name prefixed with a period. | |
*/ | |
async function registerWbComponent(selector: string): Promise<void> { | |
if (typeof window !== "undefined") { | |
const wet: WetBoew = (window as any).wb as WetBoew; |
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
|
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// A custom React Hook for using CKEditor with SSR | |
// particularly with NextJS. | |
// https://ckeditor.com | https://nextjs.org | |
import React, { useRef, useState, useEffect } from 'react' | |
export default function useCKEditor () { | |
const editorRef = useRef() | |
const [isEditorLoaded, setIsEditorLoaded] = useState(false) | |
const { CKEditor, InlineEditor } = editorRef.current || {} |
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 strict'; // avoid ambiguity and sloppy errors | |
/** | |
* Tests whether or not a given string is a Palindrome | |
* @param {string} stringToTest - the string to test. | |
*/ | |
function isPalindrome(stringToTest) { | |
if (typeof stringToTest !== "string") { | |
throw new TypeError("isPalindrome() expected a string, but got " + | |
Object.prototype.toString.call(stringToTest) + " instead!"); |
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 requiredParam (param) { | |
const requiredParamError = new Error( | |
`Required parameter, "${param}" is missing.` | |
) | |
// preserve original stack trace | |
if (typeof Error.captureStackTrace === ‘function’) { | |
Error.captureStackTrace( | |
requiredParamError, | |
requiredParam | |
) |
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
var s = "some_string_to_change", | |
result = s.replace(/_./g, rep); // do a global search (g) for an "_" followed by a single character (.) and run the rep function each time | |
function rep(v) { | |
return v[1].toUpperCase(); // return the second character of the matched string, uppercased. | |
} | |
console.log(result); |
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
var s = "some_string_to_change", | |
a = s.split("_"), // this gives us 4 strings and removes the underscore | |
result = a[0]; // this adds the first string to our result | |
for(i=1;i<a.length;i++) { // loop through each string | |
result+= a[i][0].toUpperCase(); // append the uppercase first letter of the string | |
result+= a[i].substring(1); // append the rest of the string | |
} | |
console.log(result); // log the result to the console |
NewerOlder