Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| import React from 'react' | |
| import ReactDOM from 'react-dom' | |
| const Hello = ({name}) => <h1>Hello {name}!</h1> | |
| ReactDOM.render( | |
| <Hello name={"vjeux"}/>, | |
| document.body.appendChild(document.createElement("div")) | |
| ) |
| (function($, window, undefined) { | |
| var InfiniteScroll = function() { | |
| this.initialize = function() { | |
| this.setupEvents(); | |
| }; | |
| this.setupEvents = function() { | |
| $(window).on( | |
| 'scroll', | |
| this.handleScroll.bind(this) |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="CH 4 functions" content="Javascript Patterns"> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </headJavascript patterns | |
| <body> | |
| Javascript Patterns, by Stoyan Stefanov (O'Reilly). Copyright 2010 Yahoo!, Inc., 9780596806750. | |
| <script id="jsbin-javascript"> |
| function getAllPermutations(string) { | |
| var results = []; | |
| if (string.length === 1) { | |
| results.push(string); | |
| return results; | |
| } | |
| for (var i = 0; i < string.length; i++) { | |
| var firstChar = string[i]; |
| /** | |
| * Copyright 2012 Akseli Palén. | |
| * Created 2012-07-15. | |
| * Licensed under the MIT license. | |
| * | |
| * <license> | |
| * Permission is hereby granted, free of charge, to any person obtaining | |
| * a copy of this software and associated documentation files | |
| * (the "Software"), to deal in the Software without restriction, | |
| * including without limitation the rights to use, copy, modify, merge, |
| //return an array of objects according to key, value, or key and value matching | |
| function getObjects(obj, key, val) { | |
| var objects = []; | |
| for (var i in obj) { | |
| if (!obj.hasOwnProperty(i)) continue; | |
| if (typeof obj[i] == 'object') { | |
| objects = objects.concat(getObjects(obj[i], key, val)); | |
| } else | |
| //if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
| if (i == key && obj[i] == val || i == key && val == '') { // |
| /* Polyfill indexOf. */ | |
| var indexOf; | |
| if (typeof Array.prototype.indexOf === 'function') { | |
| indexOf = function (haystack, needle) { | |
| return haystack.indexOf(needle); | |
| }; | |
| } else { | |
| indexOf = function (haystack, needle) { | |
| var i = 0, length = haystack.length, idx = -1, found = false; |
| import java.io.IOException; | |
| import java.net.URLClassLoader; | |
| import java.nio.file.Files; | |
| import java.nio.file.Paths; | |
| import java.nio.file.Path; | |
| /** | |
| * Example demonstrating a ClassLoader leak. | |
| * | |
| * <p>To see it in action, copy this file to a temp directory somewhere, |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParentelem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeightelem.getClientRects(), elem.getBoundingClientRect()