Installing mysql2
gem errors on m1 Mac.
Make sure mysql
, openssl
and zstd
are installed on Mac via Homebrew.
brew install mysql openssl zstd
<?php | |
function filter_anycomment_text( $data, $comment = null ) { | |
$data['content'] = preg_replace('#((?!"|\')https?://([^\s]*)\.(jpg|gif|png|jpeg|webp|svg)(?!"|\'))#', '<img class="embedded-image-link" src="$1" alt=""/>', $data['content']); | |
$data['content'] = preg_replace('/(?!.*(?:jpg|jpeg|gif|png|webp|svg))(https?:\/\/[\w\?\/\=\._-]+)/', '<a href="$1" rel="noopener">$1</a>', $data['content']); | |
return $data; | |
} | |
add_filter( 'anycomment/rest/comments/item_for_response', 'filter_anycomment_text', 10, 2 ); | |
<?php | |
function filter_anycomment_text( $data, $comment = null ) { | |
$data['content'] = preg_replace('#((?!"|\')http(s?)://([^\s]*)\.(jpg|gif|png|bmp|jpeg|webp|svg)(?!"|\'))#', '<img class="embedded-image-link" src="$1">', $data['content']); | |
$data['content'] = preg_replace_callback("/ | |
((?<![\"']) # don't look inside quotes | |
(\b | |
( # protocol or www. | |
[a-z]{3,}:\/\/ | |
| |
// Export database in gzip form | |
mysqldump -u user -p database | gzip > database.sql.gz | |
// Import database from gzip form | |
gunzip < database.sql.gz | mysql -u user -p database |
# ... | |
gem 'carrierwave' | |
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
#!/usr/bin/env ruby | |
require 'time' | |
puts ARGV.inspect | |
link = ARGV[0] | |
puts('Link is needed!') && exit if link.nil? | |
puts title = `youtube-dl -e #{link}` | |
puts duration = `youtube-dl --get-duration #{link}` | |
duration = duration.split(':') |
class Subdomain | |
def self.matches?(request) | |
request.subdomain.present? && request.subdomain != "www" | |
end | |
end | |
class Domain | |
def self.matches?(request) | |
request.domain.present? && request.domain != "mydomain.com" | |
end |
gem 'launchy' |
server { | |
server_name img.l; | |
root /var/www/cache/store/ns365; | |
index index.html; | |
# This requests the original file from itself and then resizes the image. | |
location ~ /resize/(\d+)x(\d+)/(.*) { | |
proxy_pass http://img.l/$3; | |
image_filter resize $1 $2; | |
image_filter_jpeg_quality 90; |