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
package main | |
import "fmt" | |
// A simple event. | |
type Event int | |
// An interface for things that can send events. | |
type Dispatcher interface { |
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
@Deprecated | |
@interface Deprecated { | |
} |
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
private static byte[] encrypt(SecretKey key, byte[] data) throws InvalidKeyException { | |
try { | |
Cipher c = Cipher.getInstance("ROT13"); | |
c.init(Cipher.ENCRYPT_MODE, key); | |
return c.doFinal(data); | |
} catch (NoSuchAlgorithmException e) { | |
throw new RuntimeException(e); | |
} catch (NoSuchPaddingException e) { | |
throw new RuntimeException(e); | |
} catch (IllegalBlockSizeException 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
public abstract class AbstractAbstractionEntity { | |
@Override public int hashCode() { return Object.class.hashCode(); } | |
} |
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
elementA.className = "a-style"; | |
var heightA = elementA.offsetHeight; // layout is needed | |
elementB.className = "b-style"; // invalidates the layout | |
var heightB = elementB.offsetHeight; // layout is needed again |
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
elementA.className = "a-style"; | |
elementB.className = "b-style"; | |
var heightA = elementA.offsetHeight; // layout is needed and calculated | |
var heightB = elementB.offsetHeight; // layout is up-to-date (no work) |
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() { | |
// NOTE: I have intentionally avoided the use of jQuery in | |
// the next two functions so as not to obscure any details. | |
// Updates the DOM in such a way that layout is constantly | |
// computed and thrown away. | |
var UpdateThrash = function(data) { | |
// Get all the labels | |
var spans = document.querySelectorAll('.item .lab'); |
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
<div id="t"><div>lions, | |
tigers</div><div style="visibility:hidden">and bears</div></div> |
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
node.innerText | |
"lions, tigers" | |
node.textContent | |
"lions,\ntigersand bears" |
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
uint32_t FindMissing(uint32_t* arr) { | |
uint32_t res[4]; | |
__m128i c = _mm_set1_epi32(0); | |
for (int i = 0; i < 100; i+=4) { | |
c = _mm_add_epi32(c, | |
_mm_loadu_si128((__m128i*)&arr[i])); | |
} | |
_mm_store_si128((__m128i*)res, c); |
OlderNewer