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
| <!doctype html><script onload="document.scripts[0].remove()"> | |
| var html = | |
| `<html> | |
| <head> | |
| <title>Test page</title> | |
| <style> | |
| input:hover { | |
| outline: 3px solid red; | |
| } | |
| </style> |
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 Component<T>(view: (attributes: T, children: Array<any>) => Mithril.VirtualElement): () => Mithril.Component<Mithril.ControllerWithAttributes<T>> & { attributes?: T} { | |
| return () => ({ view(n) { return view(n.attributes, n.children); } } as any); | |
| } | |
| var Abc = Component<{ input:string, value:string }>(a => | |
| <div>{a.input}</div> | |
| ); | |
| var t = <Abc input="true" value="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
| window.onclick = function(e) { | |
| var d = document.createElement("div"); | |
| d.style = `position: fixed; top: ${e.clientY}px; left: ${e.clientX}px; outline: 3px solid ${e.ctrlKey ? 'green' : 'red'};`; | |
| document.body.appendChild(d); | |
| } |
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
| # Open a command prompt and type the following lines: | |
| cd C:\type\the\path\to\the\folder\containing\the\cs\file | |
| C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe extract-colors.cs /reference:System.Drawing.dll | |
| extract-colors.exe > result.txt |
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
| // ================================================================ | |
| // enable to update a set of properties with a single call | |
| // ================================================================ | |
| StylePropertyMapReadOnly.prototype.update = function(updaters) { | |
| var oldValues = Object.create(null); | |
| for(var key in updaters) { oldValues[key] = this.get(key); } | |
| for(var key in updaters) { let newValue = updaters[key](oldValues); if (newValue) this.set(key, newValue); } | |
| } |
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
| use std::collections::hash_map::HashMap; | |
| use std::hash::Hash; | |
| pub struct Trie<K, V> where K: std::fmt::Debug+Eq+Hash+Clone, V: std::fmt::Debug+Clone { | |
| value: Option<V>, | |
| children: HashMap<K, Trie<K, V>>, | |
| } | |
| impl<K, V> Trie<K,V> where K: std::fmt::Debug+Eq+Hash+Clone, V: std::fmt::Debug+Clone { | |
| pub fn new() -> Trie<K, V> { |
OlderNewer