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
| <script type='text/javascript' src="js/jquery.min.js"></script> | |
| <script type='text/javascript'> | |
| // Size the parent iFrame | |
| function iframeResize() { | |
| var height = $('body').outerHeight(); // IMPORTANT: If body's height is set to 100% with CSS this will not work. | |
| parent.postMessage("resize::"+height,"*"); | |
| } | |
| $(document).ready(function() { | |
| // Resize iframe |
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 debounce = (fn, time) => { | |
| let timeout; | |
| return function() { | |
| const functionCall = () => fn.apply(this, arguments); | |
| clearTimeout(timeout); | |
| timeout = setTimeout(functionCall, time); | |
| } | |
| } |
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
| # Configure the reverse-proxy on port 443 | |
| server { | |
| # general configs | |
| keepalive_timeout 30; | |
| listen 127.0.0.1:443 ssl; | |
| server_name api.example.com; | |
| # ssl configs | |
| ssl_certificate /path/to/api.crt; | |
| ssl_certificate_key /path/to/api.key; |
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
| ENVIRONMENT=development | |
| HOSTNAME=localhost:4000 | |
| MONGODB_DB=reactnodenew | |
| MONGODB_HOST=localhost | |
| MONGODB_PASS= | |
| MONGODB_PORT=27017 | |
| MONGODB_QUERIES= | |
| MONGODB_SSL=FALSE | |
| MONGODB_USER= | |
| NODE_ENV=development |
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
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { | |
| // no easing, no acceleration | |
| linear: t => t, | |
| // accelerating from zero velocity | |
| easeInQuad: t => t*t, | |
| // decelerating to zero velocity |
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 debounce(callback, wait, immediate = false) { | |
| let timeout = null | |
| return function() { | |
| const callNow = immediate && !timeout | |
| const next = () => callback.apply(this, arguments) | |
| clearTimeout(timeout) | |
| timeout = setTimeout(next, wait) |
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 throttle(callback, wait, immediate = false) { | |
| let timeout = null | |
| let initialCall = true | |
| return function() { | |
| const callNow = immediate && initialCall | |
| const next = () => { | |
| callback.apply(this, arguments) | |
| timeout = null | |
| } |
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
| <?php | |
| function theme_metabox_per_page() { | |
| global $pagenow; | |
| if ( $pagenow == 'post.php' ) { | |
| $page_id = ( $_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['post_ID'] ) ? $_POST['post_ID'] : $_GET['post']; | |
| if ( $page_id ) { | |
| $page_slug = get_post_field( 'post_name', $page_id ); |
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
| <?php | |
| function get_custom_post_meta_cb($object, $field_name, $request) { | |
| return get_post_meta( $object['id'], $field_name, true ); | |
| } | |
| function get_custom_post_meta_cb_the_content($object, $field_name, $request) { | |
| return apply_filters( 'the_content', get_post_meta( $object['id'], $field_name, 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
| <?php | |
| add_action('rest_api_init', function () { | |
| register_rest_route( 'contact/v1', 'send', [ | |
| 'methods' => 'POST', | |
| 'callback' => 'api_send_contact_form' | |
| ]); | |
| }); | |
| function api_send_contact_form( $request ) { |
OlderNewer