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 highlightNumerical(searchString, inString) { | |
// http://jsfiddle.net/meglio/p9KUV/ | |
if (typeof searchString == "object") { | |
if (searchString.length) | |
searchString = searchString[0] | |
else | |
return inString | |
} | |
var prefix = '<strong class="highlight">', suffix = '</strong>', |
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 AjaxItems($container, config) { | |
var defaultOpts = { | |
textNoItems: "Не знайдено", | |
removalActionClass: "actionRemove", | |
removalDialog: function(el) { return confirm('Видалити?') }, | |
showNoItems: function($container, message) { | |
$container.empty().append( $div().text(message) ) | |
}, | |
// If you want item removal to be handled, add an element with class .actionRemove (or another specified in removalActionClass option) | |
itemDom: function(el) { |
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 EditableDomElements($container, selector, config) { | |
var defaultOpts = { | |
textCancel: "Відміна", | |
textSave: "Зберегти", | |
textNoText: null, | |
inputType: 'textarea', // textarea|input | |
extractTextFromView: function($view) { return $view.text().trim() }, | |
setTextToView: function($view, text) { $view.empty().text(text) }, | |
configureTextarea: function($editor, $view) { $editor.height($view.outerHeight()) }, | |
placeEditor: function($editor, $view) { $editor.insertAfter($view) }, |
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 | |
header('Content-Type: text/css'); | |
$cacheFile = __DIR__.'/css/cached.css'; | |
$listFile = __DIR__.'/css/cached-list.txt'; | |
$htmlFile = __DIR__.'/tmpl/web/html5.twig'; | |
$htmlTime = filemtime($htmlFile); | |
$cacheTime = file_exists($cacheFile)? filemtime($cacheFile) : 0; |
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 | |
namespace proj\utils; | |
class TimebasedUrl | |
{ | |
static function js($path) | |
{ | |
return '<script type="text/javascript" src="'.self::url($path).'"></script>'; | |
} |
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 | |
header('Content-Type: text/javascript'); | |
$cacheFile = __DIR__.'/js/cached.js'; | |
$listFile = __DIR__.'/js/cached-list.txt'; | |
$htmlFile = __DIR__.'/tmpl/web/html5.twig'; | |
$htmlTime = filemtime($htmlFile); | |
$cacheTime = file_exists($cacheFile)? filemtime($cacheFile) : 0; |
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; | |
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
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
// 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] |