Skip to content

Instantly share code, notes, and snippets.

View paulchubatyy's full-sized avatar
🤍
Evaporating

Paul (xobb) Chubatyy paulchubatyy

🤍
Evaporating
View GitHub Profile
<?php
//....
Kohana::modules(array(
// 'database' => MODPATH.'database', //Database
// 'kodoc' => MODPATH.'kodoc', // Kohana documentation
// 'orm' => MODPATH.'orm', // Object Relationship Mapping (not complete)
'auth' => MODPATH.'auth', // Database access
'pagination' => MODPATH.'pagination', // Paging of results
'image' => MODPATH.'image', // Image manipulation
'doctrine' => MODPATH.'doctrine', // Doctrine ORM
@paulchubatyy
paulchubatyy / php52.sh
Created October 28, 2010 14:54
Revert to php 5.2
#! /bin/bash
php_installed=`dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# remove all php packge
sudo aptitude purge $php_installed
# use karmic for php pakage
# pin-params: a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
@paulchubatyy
paulchubatyy / apacherestart
Created November 1, 2010 11:59
install msmtp
sudo service apache2 restart
@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
<?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')
<?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);
}
SELECT
anmeldelser.billed_sti ,
anmeldelser.overskrift ,
anmeldelser.indhold ,
anmeldelser.id ,
anmeldelser.godkendt,
FROM
anmeldelser
UNION SELECT
nyheder.id ,
@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
@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
<?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();