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 declOfNum(number, titles) { | |
| cases = [2, 0, 1, 1, 1, 2]; | |
| return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
| } | |
| use: | |
| declOfNum(count, ['найдена', 'найдено', 'найдены']); |
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 | |
| $infile=$_SERVER['argv'][1]; | |
| $outfile=$_SERVER['argv'][2];if (!$infile || !$outfile) { | |
| die("Usage: php {$_SERVER['argv'][0]} <input file> <output file>\n");} | |
| echo "Processing $infile to $outfile\n"; | |
| $data="ob_end_clean();?>"; | |
| $data.=php_strip_whitespace($infile); | |
| // compress data | |
| $data=gzcompress($data,9); | |
| // encode in base64 |
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
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| import lxml.html | |
| f = open('in.htm', 'r') | |
| html = f.read() | |
| f.close() | |
| doc = lxml.html.document_fromstring(html) | |
| for tr in doc.xpath('//*[@style="border: 1px solid rgb(178, 178, 178); width: 70px; height: 40px; overflow: hidden; margin-left: 5px;"]'): |
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
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ 4 mtd """ | |
| str = 'magga pes "mtd tozhe"' | |
| print str[str.find('"'):]; |
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
Show hidden characters
| { | |
| "close_windows_when_empty": false, | |
| "color_scheme": "Packages/Colorscheme/Twilight.tmTheme", | |
| "find_selected_text": true, | |
| "folder_exclude_patterns": | |
| [ | |
| ".svn", | |
| ".git", | |
| ".hg", | |
| "CVS", |
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
| [ | |
| { "keys": ["super+e"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
| { "keys": ["super+shift+b"], "command": "expand_selection", "args": {"to": "brackets"} }, | |
| { "keys": ["super+b"], "command": "move_to", "args": {"to": "brackets"} }, | |
| { "keys": ["super+k"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, | |
| { "keys": ["super+r"], "command": "show_panel", "args": {"panel": "replace"} }, | |
| { "keys": ["super+shift+r"], "command": "replace_next" }, | |
| { "keys": ["super+s"], "command": "save" }, | |
| { "keys": ["super+shift+s"], "command": "prompt_save_as" }, | |
| { "keys": ["super+u"], "command": "upper_case" }, |
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
| SELECT SUBSTRING_INDEX(Email, '@', -1) as Domain, count(*) as Total | |
| FROM Users | |
| GROUP BY Domain | |
| ORDER BY Total DESC | |
| LIMIT 15; |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Алгоритм Дейкстры | |
| # Находит кратчайшее расстояние от одной из вершин графа до всех остальных. | |
| # Алгоритм работает только для графов без рёбер отрицательного веса. | |
| # Матрица задается как список словарей смежности вершин | |
| # Описание алгоритма http://goo.gl/KsqC | |
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 random_password( $length = 8 ) { | |
| $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; | |
| $password = substr( str_shuffle( $chars ), 0, $length ); | |
| return $password; | |
| } |
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
| [ | |
| { "keys": ["ctrl+e"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
| { "keys": ["ctrl+shift+b"], "command": "expand_selection", "args": {"to": "brackets"} }, | |
| { "keys": ["ctrl+b"], "command": "move_to", "args": {"to": "brackets"} }, | |
| { "keys": ["ctrl+k"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, | |
| { "keys": ["ctrl+r"], "command": "show_panel", "args": {"panel": "replace"} }, | |
| { "keys": ["ctrl+shift+r"], "command": "replace_next" }, | |
| { "keys": ["ctrl+s"], "command": "save" }, | |
| { "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, | |
| { "keys": ["ctrl+u"], "command": "upper_case" }, |
OlderNewer