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 | |
//.... | |
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 |
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 | |
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 |
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
sudo service apache2 restart |
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 | |
// .... bootstap.php | |
Route::set('messages', 'messages/<action>/<user>(<format>)', array('format' => '\.\w+')) | |
->defaults(array( | |
'format' => '.json', | |
'controller' => 'messages', | |
)); | |
// .... bootstrap.php |
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 | |
// ... | |
// 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') |
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 | |
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); | |
} |
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 | |
anmeldelser.billed_sti , | |
anmeldelser.overskrift , | |
anmeldelser.indhold , | |
anmeldelser.id , | |
anmeldelser.godkendt, | |
FROM | |
anmeldelser | |
UNION SELECT | |
nyheder.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
git remote add upstream https://github.com/mattrude/wordpress.git | |
git fetch upstream | |
git checkout -b integration | |
git merge --no-ff upstream/3.1 |
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 | |
/* | |
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 |
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 | |
$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(); |