Skip to content

Instantly share code, notes, and snippets.

View paulchubatyy's full-sized avatar
🤍
Evaporating

Paul (xobb) Chubatyy paulchubatyy

🤍
Evaporating
View GitHub Profile
@paulchubatyy
paulchubatyy / move to lviv.sh
Created March 19, 2011 20:04
Mini how-to move to Lviv
tar -zcvf stuff.tar.gz ~/* \
&& scp stuff.tar.gz xobb@lviv:stuff.tar.gz \
&& rm -rf ~/* \
&& ssh xobb@lviv \
&& tar -zxvf stuff.tar.gz
<?php
//Шлях до файла.
$files = file('songs.html');
//рахуємо кількість файлів
$count = count($files);
//Понеслись!
for ($i = 0; $i < $count; $i++) {
//Забрали теги нафіг і стрімили перевод строчки
$source = trim(strip_tags($files[$i]));
// Написали якусь каляку шо робиться
<?php
// Вішаємось на післяроутингу
// це викличе нашу функцію коли роутинг закінчиться
Event::add('system.post_routing' ,'call_fallback_page');
function call_fallback_page()
{
// визначаємо чи наразі визначений контроллер
if (Router::$controller === NULL) {
// контроллера нема, якраз наш випадок!
Router::$controller = 'page';
<?php
$reg_exp = '#<a [^>]*href=\\?[\'"](?P<url>http:\/\/[0-9a-z]+\.[0-9a-z]{5,10}\.(pay|hop)\.clickbank\.net)\\?[\'"][^>]*>#is';
$text = '
ololololol trolololololol
<a href=\"http://123.ololo.pay.clickbank.net\">ololol trololo</a>
<a href=\"http://affiliate.ol00lo.hop.clickbank.net\">ololo trololo</a>
';
$matches = array();
@paulchubatyy
paulchubatyy / gistpress.php
Created February 28, 2011 19:24
gist shortcode for wordpress
<?php
/*
Plugin Name: GistPress
Plugin URI: http://wordpress.org/extend/plugins/github-gist
Description: Embed your gists to posts
Usage: add gist id and file (if required)
[gist id="847852" file="gistpress.php"/]
Version: 0.1
@paulchubatyy
paulchubatyy / merge1.sh
Created February 26, 2011 15:08
Create a new branch and merge upstream/3.1 there
git remote add upstream https://github.com/mattrude/wordpress.git
git fetch upstream
git checkout -b integration
git merge --no-ff upstream/3.1
SELECT
anmeldelser.billed_sti ,
anmeldelser.overskrift ,
anmeldelser.indhold ,
anmeldelser.id ,
anmeldelser.godkendt,
FROM
anmeldelser
UNION SELECT
nyheder.id ,
<?php
function do_shortcode($content) {
global $shortcode_tags;
if (empty($shortcode_tags) || !is_array($shortcode_tags))
return $content;
$pattern = get_shortcode_regex();
return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
}
<?php
// ...
// Example A - Load user model directly in traditional style
$user_a = new User('[email protected]')
->load($db);
// Example B - Load user model using HMVC style
$user_b = Request::factory('users/[email protected]')
->method('GET')
->header('Accept', 'application/json')
@paulchubatyy
paulchubatyy / bootstrap.php
Created November 17, 2010 12:14
Examples for translation of Scaling Web Applications by samsoir
<?php
// .... bootstap.php
Route::set('messages', 'messages/<action>/<user>(<format>)', array('format' => '\.\w+'))
->defaults(array(
'format' => '.json',
'controller' => 'messages',
));
// .... bootstrap.php