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 | |
| /** | |
| * Serves for routing purposes and can be used in 2 modes: | |
| * 1. Build the full map and then process | |
| * 2. Process on the go until a matched mapping is found | |
| * | |
| * Reads request uri path from $_GET['_REQUEST_URI'] | |
| */ |
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
| .action-success { | |
| position: absolute; | |
| z-index: 1000; | |
| color: green; | |
| border: 1px dashed green; | |
| background-color: rgba(255,255,255,0.5); | |
| font-size: 14px; | |
| padding: 2px 4px; | |
| border-radius: 8px; | |
| text-align: center; |
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 | |
| /** | |
| * Trait Lazy | |
| * | |
| * Allows for static and dynamic lazy initialization. | |
| * NB. Include "use Lazy;" in every class you want this functionality, otherwise collision may happen if any of parents use Lazy. | |
| * | |
| * Example: |
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 | |
| class Arr | |
| { | |
| static function get($arr, $keys = null, $default = null) | |
| { | |
| if (is_null($keys)) | |
| return $arr; | |
| foreach((array)$keys as $k) | |
| { |
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
| /** | |
| * Replaces jQuery element or its content temporarily with watch symbol of iconic font (icon-refresh) | |
| * | |
| * To be used with http://fortawesome.github.com | |
| */ | |
| function replaceByWatch(el, replaceInnerContent) { | |
| var watch = $icon('icon-refresh icon-spin') | |
| if (replaceInnerContent) { |
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 | |
| /** | |
| * Class Router is static class which serves for routing purposes and can be used in 2 modes: full-map and on-the-go modes. | |
| * | |
| * Reads request uri path from $_GET['_REQUEST_URI'] | |
| */ | |
| class Router | |
| { |
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
| // Returns { highlighted: ..., count: ... } | |
| function highlight(str, words) | |
| { | |
| var before = '<strong class="highlight">', beforeLen = before.length, | |
| after = '</strong>', afterLen = after.length | |
| if (typeof words == "string") | |
| words = [words] |
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
| package com.frazemet | |
| import scala.io.Source | |
| import xml.pull._ | |
| import collection.mutable.ListBuffer | |
| object OpenCorpora { | |
| def importFromXml(file: String) { |
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
| private static function iv() | |
| { | |
| $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); | |
| return mcrypt_create_iv($iv_size, MCRYPT_RAND); | |
| } | |
| static function encrypt($str, $key32) | |
| { | |
| # Prepend 4-chars data hash to the data itself for validation after decryption | |
| $str = substr(md5($str), 0, 4).$str; |
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
| /* | |
| * Check for PDF support | |
| * Based on http://downloads.beninzambia.com/blog/acrobat_detection.js.txt | |
| */ | |
| $.support.pdf = (function() { | |
| try { | |
| // IE | |
| if(!$.support.cssFloat) { | |
| var control = null; | |