-
Sublime
23.02.2017
Тук ще описвам интересни бележки за Sublime Любими плъгини: Emmet BracketHighlighter Color Highlighter ColorPicker (Ctrl + Shift + C ) Theme Centurion AutoFileName TabsExtra SublimeLinter sublimelinter sublimelinter-php sublimelinter-jshint HTML-CSS-JS Prettify SideBarEnhancements Super Calculator Инсталиране на jshint linux: apt-get update && apt-get install nodejs npm nodejs-legacy php; npm install -g jshint; npm install -g csshint;…
-
Инсталиране на yuicompressor (оптимизиране на js, css)
18.01.2017
1. Инсталиране на java mkdir -p /usr/share/java wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar -P /usr/share/java vi /usr/bin/yc #!/bin/sh java -jar /usr/share/java/yuicompressor-2.4.8.jar „$@“ chmod +x /usr/bin/yc yc default.css -o default-min.css yc sample.js -o sample-min.js
-
Скриване на елемент за мобилни устройства
21.10.2016
Идеята е с javascript да идентифицираме клиента по user agent-а и да скрием id блок от него. <script> var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); if (mobile) { $(‘#bu1’).hide(); } </script>
-
Google maps embed iframe – респонсив
12.07.2016
<style> .google-maps { position: relative; padding-bottom: 30%; // This is the aspect ratio height: 0; overflow: hidden; } .google-maps iframe { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; } </style> <br /><br /><center><h3>Map</h3><br /></center> <div class=’google-maps’> <iframe src=’https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2932.58550931219!2d23.29158247261225!3d42.69132162380618!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40aa85232c054953:0x408417d08050add6!2sBusiness+Centre+Serdika!5e0!3m2!1sen!2sbg!4v1468307728158" width=’600′ height=’450′ frameborder=’0′ style=’border:0′ allowfullscreen></iframe> </div>
-
mysql tips random
17.12.2015
идеята е една колона в mysql таблица да се напълни със случайни числа от 1 до 3, но от mysql. Решението: update articles set sezon_id=ceil(RAND()*3)
-
Оптимизиране на изображенията (png,jpg)
15.12.2015
Идеята е да се оптимизират изображнията за по- бързо зареждане и според Google PageSpeed Insights: find . -iname ‘*.jpg’ -print0 | xargs -0 jpegoptim –max=90 –strip-all –preserve –totals; find $PWD -type f -name „*.jpg*“ -execdir jpegoptim -v –strip-all –max=85 –preserve ‘{}’ \; find . -iname ‘*.png’ -print0 | xargs -0 optipng -o7 -preserve; Резултата: ./images/back.jpg…
-
htaccess
15.12.2015
RewriteEngine On #Options -Indexes ErrorDocument 404 /404.php #RewriteBase / #RewriteCond %{HTTP_HOST} !^DOMAIN$ [NC] #RewriteRule ^(.*)$ http://DOMAIN/$1 [L,R=301] RewriteRule ^css.min/(.*\.css) /m/?f=/css/$1 [NC,L,QSA] RewriteRule ^js.min/(.*\.js) /m/?f=/js/$1 [NC,L,QSA] ## EXPIRES CACHING ## ExpiresActive On ExpiresByType image/jpg „access 1 year“ ExpiresByType image/jpeg „access 1 year“ ExpiresByType image/gif „access 1 year“ ExpiresByType image/png „access 1 year“ ExpiresByType text/css „access 1…
-
Проблем с Google Page Speed и Facebook „Enable compression“
14.12.2015
Проблем с Google Page Speed и Facebook „Enable compression“ Гугъл казва, че трябва да се оптимизират скриптовете от facebook. Супер, но ние нямаме достъп до тях. Ето го и съобщението: Enable compression Compressing resources with gzip or deflate can reduce the number of bytes sent over the network. Enable compression for the following resources to…
-
jquery-migrate: мигриране от старо jquery към последния jquery
03.04.2015
<script type=“text/javascript“ src=“http://code.jquery.com/jquery.min.js“></script> <script type=“text/javascript“ src=“http://code.jquery.com/jquery-migrate-1.2.1.js“></script>
-
Инсталиране на WordPress в WordPress
09.03.2015
Идеята е да се инсталира wordpress + папка с още един WordPress. Примерно „/“ и „/en/“ File: /.htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress File: /en/.htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase…