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> | |
| <html> | |
| <head><head> | |
| <body> | |
| <header class="scroller"></header> | |
| <main> | |
| content must be longer than 100vh | |
| </main> |
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 urllib.request import urlopen | |
| url = "https://facebook.com" | |
| data = urlopen("http://tinyurl.com/api-create.php?url="+url) | |
| shorten_url = data.readlines()[0].decode() | |
| print(shorten_url) |
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
| // disallow select content on the page | |
| .no-select { | |
| -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 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
| <?php | |
| function getIP() | |
| { | |
| if ($_SERVER['HTTP_CLIENT_IP']) | |
| $visitorIP[] = $_SERVER['HTTP_CLIENT_IP']; | |
| if ($_SERVER['HTTP_X_FORWARDED']) | |
| $visitorIP[] = $_SERVER['HTTP_X_FORWARDED']; | |
| if ($_SERVER['HTTP_X_FORWARDED_FOR']) | |
| $visitorIP[] = $_SERVER['HTTP_X_FORWARDED_FOR']; |
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
| <?php | |
| function getLang(array $request, $default) | |
| { | |
| return | |
| !empty($request['get']['lang']) ? $request['get']['lang'] : | |
| (!empty($request['cookie']['lang']) ? $request['cookie']['lang'] : | |
| (!empty($request['session']['lang']) ? $request['session']['lang'] : | |
| (!empty($request['server']['HTTP_ACCEPT_LANGUAGE']) ? substr($request['server']['HTTP_ACCEPT_LANGUAGE'], 0, 2) : $default))); | |
| } |
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
| .image { | |
| position: relative; | |
| background: #f5f5f5; | |
| max-width: 100%; | |
| max-height: 100%; | |
| overflow: hidden; | |
| } | |
| .image:after { |
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
| .row { | |
| display: -webkit-box; | |
| display: -webkit-flex; | |
| display: -ms-flexbox; | |
| display: flex; | |
| flex-wrap: wrap; | |
| } | |
| .row > [class*='col-'] { | |
| display: flex; |
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
| const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; | |
| getStyle(document.querySelector('p'), 'font-size'); // '16px' |
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
| # Note Microsoft Excel must be installed | |
| from openpyxl import Workbook, load_workbook | |
| from win32com.client import Dispatch | |
| path = os.path.dirname(os.path.abspath(__file__)) | |
| o = Dispatch("Excel.Application") | |
| o.Visible = False | |
| o.DisplayAlerts = False |
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
| def chunks(lst, n): | |
| for i in range(0, len(lst), n): | |
| yield lst[i:i + n] | |
| lst = [1,3,5,6,7,9,5,4,2,3,5,6,7,4,3] | |
| res = list(chunks(lst, 3)) | |
| print(res) # [[1, 3, 5], [6, 7, 9], [5, 4, 2], [3, 5, 6], [7, 4, 3]] |
OlderNewer