This file contains 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
export function deepUnref<TInput>(val: MaybeRef<TInput>): TInput { | |
const checkedVal = isRef(val) ? unref(val) : val; | |
if (!isPlainObject(checkedVal)) { | |
return checkedVal; | |
} | |
if (Array.isArray(checkedVal)) { | |
return checkedVal.map(deepUnref) as TInput; | |
} |
This file contains 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, { FunctionComponent, useEffect, useRef, useState } from "react"; | |
import { Animated, StyleSheet, ViewStyle } from "react-native"; | |
interface PropTypes { | |
duration?: number; | |
isVisible?: boolean; | |
style?: ViewStyle | Array<ViewStyle>; | |
} | |
/** |
This file contains 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 createFormData(data, previousKey, formData = new FormData()) { | |
if (isPlainObject(data)) { | |
Object.keys(data).forEach(key => { | |
const value = data[key]; | |
let newKey = key; | |
if (isPlainObject(value)) { | |
return createFormData(value, key, formData); | |
} |
This file contains 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
/** | |
* Set up the Create Account Form | |
* | |
* 1. So this complicated mess is because the connect() function doesn't | |
* support forwardRef(). The trick is to create a new "connected" version of | |
* our base component. | |
* | |
* 2. And then create the exported version which is wrapped in the forwardRef() | |
* and given a displayName. This stops the linters from failing and allows | |
* forwarding of refs. |
This file contains 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, { useCallback, useState } from 'react'; | |
const FormContext = React.createContext({ | |
getInputValue: (name, defaultValue = '') => null, | |
onInputChange: name => e => {} | |
}); | |
function validate(data, rules) { | |
// validate here | |
} |
This file contains 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, { useCallback, useContext, useState } from 'react'; | |
import { connect } from 'react-redux'; | |
import { updateSomeAPIValue } from 'state/APIValue'; | |
const FormContext = React.createContext({ | |
getInputValue: (name, defaultValue = '') => null, | |
inputChange: name => e => {} | |
}); |
This file contains 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
// ==ClosureCompiler== | |
// @compilation_level ADVANCED_OPTIMIZATIONS | |
// @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js | |
// ==/ClosureCompiler== | |
/** | |
* @name MarkerClusterer for Google Maps v3 | |
* @version version 1.0.3 | |
* @author Luke Mahe | |
* @fileoverview |
This file contains 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 wpml_get_languages ($options = 'skip_missing=1&orderby=code&order=desc') { | |
$languages = icl_get_languages($options); | |
$currentID = get_queried_object_id(); | |
foreach ($languages as $key => $language) { | |
$id = icl_object_id($currentID, 'page', false, $language['language_code']); | |
$status = get_post_status($id); | |
if ($status !== 'publish') { |
This file contains 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 getSiblings = (element) => { | |
return Array.prototype | |
.slice | |
.call(element.parentNode.children) | |
.filter(item => item !== element); | |
} |
This file contains 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
<?php | |
if (! function_exists('better_get_template_part') { | |
/** | |
* A better way of getting a Wordpress Template Part. | |
* This function allows you to to omit the '.php' extension, and also pass | |
* data to the included file. | |
* | |
* The data in the array is extracted into variables for use on the |
NewerOlder