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 betweenTag($html, $tag = 'pre'){ | |
$replace = array(); | |
$j = 0; | |
do{ | |
$new = false; | |
//Поиск открывающего тэга (одного!) | |
preg_match('%(<'.$tag.'[^>]*>)(.*)%s', $html, $m); | |
if(isset($m[1], $m[2])){ | |
//Начинаем поиски закрывающих тегов (всех до конца документа) |
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
var makeNestedObject = function(key, value, pattern){ | |
var items = key.split(pattern).reverse(); | |
var obj = value; | |
for(var i=0;i<items.length;i++){ | |
var newObj = {}; | |
newObj[items[i]] = obj; | |
obj = newObj; | |
} | |
return obj; | |
}; |
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
Gruntfile.js: | |
'use strict'; | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
// jshint: { | |
// options: { |
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 ($) { | |
/** | |
* arrayUpdateSlice. | |
* Join arrays, update items with new data. | |
* add new items of updates array | |
* @param {array=} items basic array | |
* @param {array=} updates and new items array | |
* @returns {Array} | |
*/ |
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
var CalculateItems = function(str){ | |
try { | |
var jsonData = JSON.parse(str); | |
} catch(e) { | |
return {'data':false}; | |
} | |
var out = "\r\n" ; |
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
/** | |
* media height | |
*/ | |
@media (max-height:320px){ | |
} | |
@media (min-height: 480px) { | |
} | |
@media (max-height: 600px) { |
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
/** | |
* media height | |
*/ | |
@media (max-height:320px){ | |
} | |
@media (min-height: 480px) { | |
} |
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
var removeFunc = Backbone.View.prototype.remove; | |
Backbone.View.prototype.remove = function(){ | |
if(this.children){ | |
_.each(this.children, function(item){ | |
item.remove(); | |
}); | |
} |
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
var apiRelationalCollection = { | |
method:false, | |
type:false, | |
loading:function(data){ | |
return data; | |
}, | |
data:false, | |
relational: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
var items = _.sortBy(this.models, function(model){ | |
var custom_data = ''; | |
custom_data += model.get('year').toString(); | |
custom_data += model.get('month').toString(); | |
custom_data += model.get('week').toString(); | |
model.set({sort_data:parseInt(custom_data)},{silent:true}); | |
return parseInt(custom_data); |