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
| <script> | |
| directives: { | |
| 'inner-height': { | |
| bind: function() { | |
| this.el.addEventListener('load', () => { | |
| var doc = this.el.contentDocument || this.el.contentWindow.document; | |
| this.el.style.height = doc.body.scrollHeight + 'px'; | |
| }); | |
| } | |
| } |
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
| from collections import OrderedDict | |
| class PHPArray(OrderedDict): | |
| def __init__(self): | |
| super().__init__() | |
| self.next_max_index = 0 | |
| def __setitem__(self, key, val): | |
| if isinstance(key, int): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| import functools | |
| import time | |
| def retry(exception, max_retry, sleep, err_handler): | |
| """ Catching exception and retrying | |
| """ | |
| def dec(f): | |
| @functools.wraps(f) | |
| def _wrapped(*args, **kwargs): |
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
| <html> | |
| <head> | |
| <script src="/js/html2canvas.min.js"></script> | |
| </head> | |
| <body> | |
| <button class="screen-shot">ScreenShot</button> | |
| <script> | |
| var btn = document.querySelector('.screen-shot'); | |
| btn.addEventListener("click", function() { | |
| if (!window.opener || window.opener.closed) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| // This way didn't work. | |
| // Cause this custom.js or nbextensions files will be loaded after initializing JupyterNotebookApp. | |
| // It means this code won't affect to it's initializing Ajax requests. | |
| // Sending token on each XHRs too. | |
| // Because Safari won't handle Cookie and localStorage | |
| // on iframes. | |
| // Jupyter Client expects it's cookie, so it will be forbidden | |
| // Instead, sending "token" by manually on each XHRs. |
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
| """ Detect changes of Django Models. | |
| """ | |
| class ChangeDetector: | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| self._dirty_fields = {f: False for f in self._get_field_names()} | |
| self._inited = 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
| > class F { | |
| ... constructor (a) { | |
| ..... if (a > 0) { | |
| ....... this.child = new F(a-1) | |
| ....... } | |
| ..... } | |
| ... } | |
| undefined | |
| > new F(3) | |
| F { child: F { child: F { child: F {} } } } |
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
| from dataclasses import dataclass, field as dc_field | |
| # Library | |
| def field(default, verbose_name="", help_text=""): | |
| return dc_field( | |
| default=default, | |
| metadata={ |