🏋️♂️
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 | |
/** | |
* Please be aware. This gist requires at least PHP 5.4 to run correctly. | |
* Otherwise consider downgrading the $opts array code to the classic "array" syntax. | |
*/ | |
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true) | |
{ | |
$needle = 'StreamTitle='; | |
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36'; |
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
;(function (w, $, undefined) { | |
"use strict"; | |
w.ajaxRouter = function (event, url) { | |
if (event.ctrlKey) | |
return true; // CTRL+CLICK opens link in new tab -> no ajax, default behaviour | |
else { | |
var url = url || $(this).attr('href'), | |
matches = /^http[s]?\:\/\/([^/]+)/.exec(url); | |
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 | |
class Curl | |
{ | |
const HTTP_OK = 200; | |
const HTTP_NOT_FOUND = 404; | |
const HTTP_INTERNAL_SERVER_ERROR = 500; | |
const TEXT_HTML = 'text/html'; | |
const TEXT_PLAIN = 'text/plain'; |
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 | |
namespace Acme\Bundle\Bundlename\DependencyInjection; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\Config\FileLocator; | |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |
use Symfony\Component\DependencyInjection\Loader; | |
/** |
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
# /etc/apache2/sites-enabled/site | |
<VirtualHost *:80> | |
RewriteEngine On | |
RewriteOptions Inherit | |
ServerAdmin admin@example.com | |
ServerName example.com |
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
DELETE `t` FROM `category_translation` AS `t` | |
LEFT JOIN `category` AS `c` | |
ON `c`.`id` = `t`.`id` | |
WHERE `c`.`id` IS 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
# Example 1 | |
mysqldump --databases dbname -u root -p > dbname.sql | |
# Example 2 | |
mysqldump --databases dbname -u root -pPASSWORD | gzip -c > dbname.sql.gz | |
# Example 3 (just the schema with no data and disabling foreign keys) | |
mysqldump -u root -pPASSWORD --no-data --single-transaction --quick --lock-tables=false -y --disable-keys dbname | gzip -c > dbname_schema.sql.gz | |
# Example 4 (loading the DB back into MySQL) |
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
<VirtualHost *:443> | |
SSLEngine On | |
# sudo apt-get install ssl-cert | |
# sudo a2enmod ssl | |
# Generate the crt file with: sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/www.example.com.crt | |
SSLCertificateFile /etc/apache2/ssl/www.example.com.crt | |
ServerName www.example.com |
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
<LocationMatch ^/(folder1|folder2|folder3\/child)/(.*)[\/]{0,1}feed> | |
Order deny,allow | |
Deny from all | |
Allow from mydomain.com 80.80.80.10/15 | |
</LocationMatch> |
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
<VirtualHost *:443> | |
SSLEngine On | |
SSLCertificateFile /etc/apache2/ssl/www.example.com.crt | |
ServerName example.com | |
ServerAlias www.example.com | |
<Directory "/var/www/example/"> | |
AllowOverride All | |
Order allow,deny |
OlderNewer