Some vanilla equivalents to jQuery methods.
jQuery:
| import {useEffect} from 'react' | |
| import {RecoilRoot, useRecoilState, atom} from 'recoil' | |
| // User data | |
| const user1 = {username: 'joe', bio: "You will never see me, unless of course this example is totally broken."} | |
| const user2 = {username: 'bob', bio: "I am the one true user."} | |
| const user3 = {username: 'fred', bio: "Just kidding, make way for the new guy."} | |
| // Recoil atom to store user. The default user is user1, but it will be |
| (function () { | |
| var thElm; | |
| var startOffset; | |
| // Create 'grip' elements near the right border and bind mouse down event to | |
| // resize | |
| Array.prototype.forEach.call( | |
| document.querySelectorAll("table th"), | |
| function (th) { | |
| th.style.position = 'relative'; |
| /** | |
| * This code is licensed under the terms of the MIT license | |
| * | |
| * Deep diff between two object, using lodash | |
| * @param {Object} object Object compared | |
| * @param {Object} base Object to compare with | |
| * @return {Object} Return a new object who represent the diff | |
| */ | |
| function difference(object, base) { | |
| function changes(object, base) { |
| <?php | |
| // Based on <https://github.com/mecha-cms/x.minify> | |
| namespace x\minify\_ { // start namespace | |
| $n = __NAMESPACE__; | |
| \define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
| \define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
| R = React.DOM | |
| nations = ['britain', 'ireland', 'norway', 'sweden', 'denmark', 'germany', | |
| 'holland', 'belgium', 'france', 'spain', 'portugal', 'italy', 'switzerland'] | |
| Typeahead = React.createClass | |
| getInitialState : -> {input: ""} | |
| handleChange : -> @setState input: @refs.field.getDOMNode().value | |
| handleClick : (nation)-> @setState input: nation | |
| matches : (input)-> |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |