» Publishers, Monetize your RSS feeds with FeedShow: More infos (Show/Hide Ads)
First write in terminal: which sendmail wlll return path to sendmail app (in my case /usr/sbin/sendmail). Then open php.ini file and setup:
sendmail_path = /usr/sbin/sendmail -t -i
Create necessary folder and setup postfix permissions:
sudo mkdir -p /Library/Server/Mail/Data/spool sudo /usr/sbin/postfix set-permissions sudo /usr/sbin/postfix start
And check if emails will come:
php -r "mail('youremail@domain.com', 'subject', 'message', 'From: <youremail@domain.com>' . PHP_EOL);"
Instalace Pear
cd /usr/local sudo curl http://pear.php.net/go-pear.phar -o go-pear.phar sudo php go-pear.phar
V mnoha případech bude potřeba přidat cestu k pear do ~/.bash_profile pomocí příkazu: export PATH=/opt/local/bin:$PATH. Pro ověření instalace stačí spustit which pear výslekdem by měla být cesta k binárce pear /opt/local/bin/pear. Nezapomeňte po sobě uklidit sudo rm go-pear.phar.
Ověřte, zda máte správně nastavenu include path:
php -r 'echo get_include_path() . PHP_EOL;' # overeni nastaveni include path
Ostatní kontroly jsou popsány zde: http://pear.php.net/manual/hu/installation.checking.php
Instalace Codesniffer
sudo pear install PHP_CodeSniffer
Code sniffer binárku phpcs najdete ve svém domovském adresáři cd ~/pear/bin/
sudo ./phpcs -i # zobrazi nainstalovane standardy
Vlastní code sniffer standardy postačí nakopírovat do složky ~/pear/share/pear/PHP/CodeSniffer/Standards
sudo ./phpcs --config-set default_standard Zend
Instalace PHPUnit
sudo pear config-set auto_discover 1; sudo pear install pear.phpunit.de/PHPUnit pear info phpunit/PHPUnit # vypsani informaci o balicku
#php #phpunit #pear #mac #codesniffer
Getting user by field name is easy, #Wordpress have function for that get_user_by. Getting user by his metadata is a little bit complicated. You can found on the Internet some complex procedures how to get user by metadata using WP_Query object. Forget about them!
You need prepare correct meta query as array or string and call get_users. Thats all!
/**
* Get user by his metadata
* @author Roman Ozana <ozana@omdesign.cz>
* @param $meta_key
* @param $meta_value
* @return mixed
*/
function get_user_by_meta($meta_key, $meta_value) {
return reset(
get_users(
array(
'meta_key' => $meta_key,
'meta_value' => $meta_value,
'number' => 1,
'count_total' => false
)
)
);
}
Úžasné záběry pořízené díky novému stabilizátoru MōVI
@media only screen and (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi) {
/* it's retina yeah! */
}
Run Automator and create new Application. Add task Run Shell script and paste follow code:
STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ];
then
defaults write com.apple.finder AppleShowAllFiles NO
else
defaults write com.apple.finder AppleShowAllFiles YES
fi
killall Finder
Save application. From now can Tooggle
Add follow code to main less file:
#responsive {
.debug(@text) {
body:before {
background: yellowgreen;
display: block;
padding: 5px;
text-align: center;
content: @text;
}
}
}
I have separate css rules for madia max-width:767 screen in file responsive-767.less. This file is inserted to main less by following line:
@import "src-less/responsive-767"(max-width: 767px);
On the first line of responsive-767.less is
#responsive > .debug('Landscape phone to portrait tablet (max-width: 767px)');
On the page with max-width 767 will show on top green debug banner:
![]()
There is generated CSS code:
@media (max-width:767px){body:before{background:yellowgreen;display:block;padding:5px;text-align:center;content:'Landscape phone to portrait tablet (max-width: 767px)';}
#lesscss #less #debug #css #en
There is simple way how to install Composer on Mac OS
sudo curl -s http://getcomposer.org/installer | php && mv ./composer.phar /usr/local/bin/composer
Now you can run composer from command line anywhere! Including self-update:
sudo composer self-update
The new version of Twitter API 1.1 wrongly requires OAuth for oEmbed part of API. I found the discussion of this problem in #Wordpress trac and one very encouraging response from Andrew Nacin:
Andrew Nacin: Initial response from Twitter is that “the endpoint will continue to operate unauthenticated, as-is the spirit of oEmbed.” Still trying to confirm whether that means 1.0′s oEmbed endpoint will remain in operation past the 1.0 shutdown, if 1.1′s oEmbed endpoint will be changed to be entirely unauthenticated, or both. Either way, we’re in the clear in terms of not needing to implement something new.
Constants for expressing human-readable intervals in new #Wordpress are very useful:
define( 'MINUTE_IN_SECONDS', 60 ); define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS ); define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS ); define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS ); define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
Example:
wp_cache_add($key, $data, 'default, 5 * DAY_IN_SECONDS);
WordPress using a lot globals variables. These variables are used throughout WordPress code for various reasons. Great example is database connection object wpdb. Here is common example how to use wpdb in some function:
function something() {
global $wpdb;
/** @var wpdb $wpdb */
$wpdb->query('SQL...');
}
It’s highly uncomfortable and long! Therefore, I have prepared a simple object which make all global variables much more accesible from anywhere: https://gist.github.com/OzzyCzech/4737518 (PHP 5.3+ only)
function something() {
Globals::wpdb()->query('SQL...');
}
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/
Mé vylepšení spočívá v úpravě výpis chyby Assert . To je doplněno o konkrétní řádek PHP kódu, na kterém test spadl.
Nette Tester (v0.9) ------------------- PHP 5.3.20 | '/opt/local/bin/php' -c '/opt/local/var/db/php5' -c '/opt/local/etc/php5' ..F -- FAILED: /Users/roman/workspace/web/tests/settings.phpt | web/tests/settings.phpt code : \Tester\Assert::true(false); Failed asserting that FALSE is TRUE in Tester/Framework/Assert.php(210) in Tester/Framework/Assert.php(88) in web/tests/settings.phpt(9)
Úpravu najdete zde: https://gist.github.com/4671280
#PHP #Nette #Tester #NetteTester








