This file contains 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 | |
// Вішаємось на післяроутингу | |
// це викличе нашу функцію коли роутинг закінчиться | |
Event::add('system.post_routing' ,'call_fallback_page'); | |
function call_fallback_page() | |
{ | |
// визначаємо чи наразі визначений контроллер | |
if (Router::$controller === NULL) { | |
// контроллера нема, якраз наш випадок! | |
Router::$controller = 'page'; |
This file contains 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 | |
//Шлях до файла. | |
$files = file('songs.html'); | |
//рахуємо кількість файлів | |
$count = count($files); | |
//Понеслись! | |
for ($i = 0; $i < $count; $i++) { | |
//Забрали теги нафіг і стрімили перевод строчки | |
$source = trim(strip_tags($files[$i])); | |
// Написали якусь каляку шо робиться |
This file contains 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
tar -zcvf stuff.tar.gz ~/* \ | |
&& scp stuff.tar.gz xobb@lviv:stuff.tar.gz \ | |
&& rm -rf ~/* \ | |
&& ssh xobb@lviv \ | |
&& tar -zxvf stuff.tar.gz |
This file contains 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
#!/bin/bash | |
################################################## Basic | |
# this is comment | |
########### variable (quoting a variable preserves whitequotes) | |
# USERNAME='lzyy' | |
# |
This file contains 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 Model_Builder_Comment extends Jelly_Builder { | |
public function get_user_posts_comments(Model_Author $author) | |
{ | |
// Get author's posts ids | |
$post_ids = $author->get('posts')->as_array('id'); | |
// Get the comments that belong to these posts | |
return $this->where('post_id', 'IN', $post_ids); | |
} |
This file contains 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 | |
$result = Mage::getModel('customer/customer')->getCollection() | |
->join(array('pet' => $this->getTable('partners_earn_transactions')), $this->getTable('customer_entity').'.entity_id = `pet`.customer_id') // Этот метод точно есть в Collection классе? Может нужно взять getCollection()->getSelect() перед тем как колать join? | |
->addExpressionFieldToSelect('transaction_count', 'COUNT({{pet.id}})') | |
->addAttributeToFilter('country_id', $country_code) | |
->addFieldToFilter('is_active', 1) | |
->addAttributeToSort('COUNT({{pet.id}})') | |
->addAttributeToSort('SUM({{pet.points}})') | |
->groupByAttribute($this->getTable('customer_entity').'.entity_id') |
This file contains 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
/home/xobb/src/website/logs/*.log | |
/home/xobb/src/blog/logs/*.log { | |
daily | |
missingok | |
rotate 52 | |
compress | |
delaycompress | |
notifempty | |
create 0640 www-data adm | |
sharedscripts |
This file contains 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 Controller_Profile extends Controller { | |
public function action_index() | |
{ | |
$user = Auth::instance()->get_user(); | |
$vkontakte_api = Vkapi::instance($user->token); | |
// Get user profile | |
$result = $vkontakte_api->getProfiles(array('uid' => $user->vk_user_id)); | |
echo Debug::dump($result); |
This file contains 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 * | |
FROM journey j | |
JOIN location l ON l.id = j.departure_id | |
WHERE l.city = 'Ternopil'; |
This file contains 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
#!/bin/sh | |
# PHP CodeSniffer pre-receive hook for git | |
PHPCS_BIN="/usr/bin/phpcs" | |
PHPCS_CODING_STANDARD="PEAR" | |
# use coding standart dir from local repo | |
PHPCS_DIR_LOCAL=0 | |
TMP_DIR=$(mktemp -d --tmpdir phpcs-pre-receive-hook.XXXXXXXX) | |
mkdir "$TMP_DIR/source" |