| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
function declOfNum(number, titles) { | |
cases = [2, 0, 1, 1, 1, 2]; | |
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
} | |
use: | |
declOfNum(count, ['найдена', 'найдено', 'найдены']); |
<?php | |
function isUtf8($string) | |
{ | |
return preg_match('%(?:' | |
. '[\xC2-\xDF][\x80-\xBF]' // non-overlong 2-byte | |
. '|\xE0[\xA0-\xBF][\x80-\xBF]' // excluding overlongs | |
. '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' // straight 3-byte | |
. '|\xED[\x80-\x9F][\x80-\xBF]' // excluding surrogates | |
. '|\xF0[\x90-\xBF][\x80-\xBF]{2}' // planes 1-3 |
#!/bin/bash | |
# Recursive file convertion windows-1251 --> utf-8 | |
# Place this file in the root of your site, add execute permission and run | |
# Converts *.php, *.html, *.css, *.js files. | |
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command | |
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f | | |
while read file | |
do |
| 😄 | 😆 | 😊 | 😃 |
😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷
😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨
<?php | |
function get_combinations($arrays) { | |
$result = array(array()); | |
foreach ($arrays as $property => $property_values) { | |
$tmp = array(); | |
foreach ($result as $result_item) { | |
foreach ($property_values as $property_value) { | |
$tmp[] = array_merge($result_item, array($property => $property_value)); | |
} |
<?php | |
/** | |
* Method to generate random date between two dates | |
* @param $sStartDate | |
* @param $sEndDate | |
* @param string $sFormat | |
* @return bool|string | |
*/ | |
function randomDate($sStartDate, $sEndDate, $sFormat = 'Y-m-d H:i:s') | |
{ |
### BEGIN INIT INFO | |
# Provides: unoconvd | |
# Required-Start: $network | |
# Required-Stop: $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Description: unoconvd Converting documents to PDF by unoconv | |
### END INIT INFO | |
#!/bin/sh | |
case "$1" in |
<?php | |
// Ignore errors | |
libxml_use_internal_errors(true) AND libxml_clear_errors(); | |
// http://stackoverflow.com/q/10237238/99923 | |
// http://stackoverflow.com/q/12034235/99923 | |
// http://stackoverflow.com/q/8218230/99923 | |
// original input (unknown encoding) |