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
new Element.html("YOUR HTML STRING HERE"); | |
// You may need to pass a NodeValidator to get everything to render, like: | |
NodeValidator nodeValidator = new NodeValidatorBuilder() | |
..allowTextElements(); | |
// ..allowHtml5() | |
// ..allowElement('Button', attributes: ['ng-disabled']); | |
new Element.html("YOUR HTML STRING HERE", validator: nodeValidator); |
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
import "dart:io"; | |
void main() { | |
// get user input using synchronous I/O | |
String input = stdin.readLineSync(); | |
// get user input and convert to lowercase | |
String inputLC = stdin.readLineSync().toLowerCase(); | |
print(input); |
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
int factorial(int number) { | |
int factorialRange(int bottom, int top) { | |
if (top == bottom) { | |
return bottom; | |
} | |
return top * factorialRange(bottom, top - 1); | |
} | |
return factorialRange(1, number); |
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
/* specific way */ | |
img { | |
-moz-user-drag: -moz-none; | |
-webkit-user-drag: none; | |
user-drag: none; | |
} | |
/* "nuke 'em all" way */ | |
img { | |
pointer-events: none; |
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
.user-select-none { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} |
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
/* Chrome */ | |
::-webkit-selection { | |
background-color: #FF68B0; | |
color: #FFF; | |
} | |
/* Firefox */ | |
::-moz-selection { | |
background-color: #FF68B0; | |
color: #FFF; |
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
class ConfigService { | |
var _config; | |
Completer _waitForConfig = new Completer(); | |
ConfigService() { | |
doHttpCall().then((result) { | |
_config = result; | |
_waitForConfig.complete(_config); | |
} |
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
void downloadFileToClient(String filename, String text) { | |
AnchorElement tempLink = document.createElement('a'); | |
tempLink | |
..attributes['href'] = 'data:text/plain;charset=utf-8,${Uri.encodeComponent(text)}' | |
..attributes['download'] = filename | |
..click(); | |
} |
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
import 'dart:html' show Element, NodeTreeSanitizer; | |
import 'package:angular2/core.dart' | |
show Directive, Input, OnChanges, SimpleChange; | |
@Directive(selector: '[safeInnerHtml]') | |
class SafeInnerHtml implements OnChanges { | |
Element _el; | |
SafeInnerHtml(this._el); |
OlderNewer