Skip to content

Instantly share code, notes, and snippets.

View RRStoyanov's full-sized avatar

Rostislav Stoyanov RRStoyanov

  • Sofia, Bulgaria
  • 09:41 (UTC +03:00)
View GitHub Profile
APP_ENV=local
APP_DEBUG=true
APP_KEY=eWXG9AInzfyQTjnqAkRNdYyqdMWg08wt
DB_HOST=localhost
DB_DATABASE=bgphp
DB_USERNAME=bgphp
DB_PASSWORD=Ddj9LjHvj4aASnXa
CACHE_DRIVER=file
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.
YouTube => http://www.youtube.com
YouTube (Playlists) => http://www.youtube.com
Dailymotion => http://www.dailymotion.com
Google Video => http://video.google.com
MegaVideo => http://www.megavideo.com
MetaCafe => http://www.metacafe.com
Revver => http://www.revver.com
Vimeo => http://www.vimeo.com
123video => http://www.123video.nl
5min Life Videopedia => http://www.5min.com
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
<?php
/**
* Changelog Markdown
*
* This is a script to transform GIT LOG into a cute format Changelog.md
*
* To use, set executable permissions to this file and execute:
* $ php changelog.php > CHANGELOG.md
*
* Copyright (c) 2013 João Pinto Neto
@RRStoyanov
RRStoyanov / gist:3018029
Created June 29, 2012 13:46
brew install php3
rew install php53 -V --with-mysql --with-cgi --with-intl --with-imap --with-gmp | tee ~/brew-install-php53.log
==> Downloading http://www.php.net/get/php-5.3.13.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php53-5.3.13
==> ./configure --prefix=/usr/local/Cellar/php53/5.3.13 --disable-debug --with-config-file-path=/usr/local/etc/php/5.3 --with-config-file-scan-dir=/usr/local/etc/php/5.3/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-sqlite-utf8 --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-pcntl --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-zend-multibyte --enable-bcmath --enable-calendar --with-openssl=/usr --with-zlib=/usr --with-bz2=/usr --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-libxml-dir=/usr/local/Cellar/libxml2/2.8.0 --with-xsl=/usr --with-curl=/usr --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/X11 --wi
@RRStoyanov
RRStoyanov / more.md
Created April 20, 2012 22:04 — forked from vasilisvg/more.md
This is my backup script which syncs my server to my dropbox every day.

The script below is triggered every day from my Mac. I use Hazel to move the tar.gz to an external hard disk once it's finished. This happens every day without me noticing.

You should have a similar script.

@RRStoyanov
RRStoyanov / Test1.php
Created March 11, 2012 14:51 — forked from snpy/Test1.php
Plain old class with multiple getters vs class with single magic method replacing multiple getters.
<?php
class Test {
public $title0 = 'string value';
public $title1 = 'string value';
public $title2 = 'string value';
public $title3 = 'string value';
public $title4 = 'string value';
public $title5 = 'string value';
public $title6 = 'string value';
@RRStoyanov
RRStoyanov / gist:1871570
Created February 20, 2012 21:27
fixTexts
public function fixTexts($string, $vid) {
$replace_find = array('–', '↑', '•', 'Ø', 'ß', 'Ö', 'Ü', 'Ä', '„', '“', '€', '×', '²', '″', '’', 'â€','€');
$replace_with = array('sss-dash-sss', 'sss-top-arrow-sss', 'sss-list-dot-sss', 'ss-rad-ss', 'ss-szlig-ss', 'ss-OOO-ss', 'ss-UUU-ss', 'ss-AAA-ss', 'ss-start-quote-ss', 'ss-end-quote-ss', 'ss-euro-ss', 'ss-xxx-ss', 'ss-sup-ss', 'ss-end-quote2-ss', 'ss-apostrophe-ss', 'ss-end-quote3-ss', 'ss-euro-ss');
$replace_with2 = array('–', '↑', '•', 'Ø', 'ß', 'Ö', 'Ü', 'Ä', '„', '“', '€', '×', '²', '″', '’', '”', '€');
$string = str_replace($replace_find, $replace_with, $string);
if (mb_check_encoding(utf8_decode($string), 'UTF-8') || in_array($vid, $this->forcedCoupons)) {
$string = utf8_decode($string);
}
$string = str_replace($replace_with, $replace_with2, $string);