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
# разбор GET параметров | |
getParams = -> | |
query = window.location.search.substring(1) | |
raw_vars = query.split("&") | |
params = {} | |
for v in raw_vars | |
[key, val] = v.split("=") | |
params[key] = decodeURIComponent(val) | |
params |
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
/* | |
* возвращает путь к локальному файлу - thumbnail'у видео с youtube | |
*/ | |
$getYoutubeThumb = function ($videoUrl) { | |
/* | |
* скачивает в кэш thumbnail видео, возвращает полный путь к файлу | |
* Имя файла = md5(url) | |
*/ | |
$downloadPic = function ($srcUrl, $getThumbUrl) { | |
return call_user_func( |
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
# Usage: <input type="hidden" ng-model="elementid" ng-update-hidden /> | |
.directive 'ngUpdateHidden', -> | |
(scope, el, attr) -> | |
model = attr["ngModel"] | |
scope.$watch model, (nv) -> | |
el.val nv | |
return | |
return |
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
# Usage examples: | |
# | |
# dataService.getTree().then((response)-> | |
# if response | |
# $scope.list = response.data | |
# | |
# dataService.saveTree(nodeData) | |
.service "dataService", ($http) -> | |
delete $http.defaults.headers.common["X-Requested-With"] |
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
/* | |
* get subcategory ids | |
*/ | |
$catID = $this->category->id; | |
$categories = JCategories::getInstance('Content'); | |
$cat = $categories->get($catID); | |
$children = $cat->getChildren(); | |
$children = array_map(function($el) { | |
return (array)$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
/* | |
*last 6 featured articles | |
*/ | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query->select('*') | |
->from($db->quoteName('#__content')) | |
->where($db->quoteName('featured') . ' = 1 ') | |
->order('created DESC'); |
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/bash | |
# бэкап mysql базы при каждом коммите | |
FILENAME=/home/www/intinity/klumbariy/db/`date +%d-%m-%Y-%H-%I-%S`.mysql | |
mysqldump intinity_klumba -u klumba \ | |
-p2UDRyHqedqnSfFfW > ${FILENAME} | |
git add $FILENAME |
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 bash | |
TEST_PATH='/home/ulv/PhpstormProjects/kinetic/oncologytest/tests/' | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ "master" == "$branch" ]; then | |
phpunit $TEST_PATH |
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 bash | |
TEST_GLOB='../../tests/test_*.php' | |
for f in $TEST_GLOB; do | |
printf "\n+ Running 'phpunit `basename ${f}`'\n\n" | |
phpunit $f | |
rc=$? | |
if [[ $rc != 0 ]] ; then |