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 myHonda = {color: "red", wheels: 4, engine: {cylinders: 4, size: 2.2}}; | |
| //console edits and results | |
| myHonda.color | |
| "red" | |
| myHonda.engine | |
| Object {cylinders: 4, size: 2.2} | |
| myHonda.engine.size | |
| 2.2 | |
| myHonda.engine.size = "3.3" |
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 | |
| // Published under GPL | |
| // tutorial here: https://codeable.io/community/how-to-import-json-into-wordpress/ | |
| class Developer_Import { | |
| public function __construct() { | |
| add_action( 'wp_ajax_import_developer', array( $this, 'import_developer' ) ); |
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
| //events - a super-basic Javascript (publish subscribe) pattern | |
| var events = { | |
| events: {}, | |
| on: function (eventName, fn) { | |
| this.events[eventName] = this.events[eventName] || []; | |
| this.events[eventName].push(fn); | |
| }, | |
| off: function(eventName, fn) { | |
| if (this.events[eventName]) { |
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
| <!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ --> | |
| <style type="text/css"> | |
| .no-fouc {display: none;} | |
| </style> | |
| <script type="text/javascript"> | |
| document.documentElement.className = 'no-fouc'; | |
| // add to document ready: $('.no-fouc').removeClass('no-fouc'); | |
| </script> |
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 $window = $(window); //Window object | |
| var scrollTime = 1.2; //Scroll time | |
| var scrollDistance = 270; //Distance. Use smaller value for shorter scroll and greater value for longer scroll | |
| $window.on("mousewheel DOMMouseScroll", function(event){ | |
| event.preventDefault(); | |
| var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3; |
OlderNewer