Author Archives: bullgare
npmsearch — поиск пакетов npm
http://npmsearch.com/
Счётчик от Google Analytics в приложении AngularJS
index.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<script type="text/javascript"> // TODO for mamba.ru only var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-...']); _gaq.push(['_setDomainName', '...']); (function () { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> |
app.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
var app = angular.module('my', []).config(); app.run(['$location', function($location) { $rootScope.$on('$locationChangeSuccess', function(e, next, current) { trackPageView(); }); function trackPageView() { if (window._gaq) { // it's optional window._gaq.push(['_setCustomVar', 1, // This custom var is set to slot #1. Required parameter. 'site_version', // The name acts as a kind of category for the user activity. Required parameter. 'my' // This value of the custom variable. Required parameter. ]); window._gaq.push(['_trackPageview'], $location.url()); } } }]); |
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables http://davidwalsh.name/ajax-analytics
Отладка страниц на Google Chrome for Android
https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=ru Вот только в помощь, как включить режм разработчика на Android 4.2+ — http://zacktutorials.blogspot.ru/2013/03/enabling-developer-options-in-android.html Репозиторий с плагином — https://github.com/GoogleChrome/ADBPlugin Можно пробросить порты — https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=ru#reverse-port-forwarding
Список обработчиков событий для элемента в Google Chrome DevTools
Правой кнопкой на элементе → Проверить элемент → Event Listeners в правом меню. Правой кнопкой на функции → Show Function Definition. https://plus.google.com/+AddyOsmani/posts/9WvgE2K2QTF Один большой минус — бесполезен для фреймвоков типа jQuery или AngularJS: показывает функцию, которая непосредственно навешивает событие, т.е. пользы — ноль.
Google Chrome Dev Tools: изменение и сохранение js и css на лету
Для этого нужен Chrome Canary. Консоль → настройки → Workspace → Add folder После этого в консоли, во вкладке Sources, можно редактировать и сохранять js-файлы (страница будет работать с уже обновлённым js, он подменяется на лету, без перезагрузки страницы). Вот инструкция с картинками — https://plus.google.com/+AddyOsmani/posts/CYXzDfg3jhC, вот видео — https://www.youtube.com/watch?v=kVSo4buDAEE. Работает также с css-файлами. Есть даже …
Разработка простого приложения под Firefox OS
http://thenittygritty.co/ffos-apps «Building Apps For Firefox OS, Chrome OS And The Web – TNG — The Nitty Gritty» от Addy Osmani.
Ограничение скорости загрузки сайта для определённых доменов под MacOS X
http://mschrag.github.io/ Очень простая штука. По сути — локальный шейпер. Ставится как prefPane (вкладка в настройках). Немного раздражает, что периодчески спрашивает пароль. Выглядит вот так:
Less Watcher для PhpStorm
Нужно поставить less и добавить watcher: Полезные ссылки: http://webdevism.alabebop.com/?p=127 http://dan.clarke.name/2013/04/env-node-no-such-file-or-directory-error-in-intellij-idea-file-watcher/
Microsoft Ergonomic Natural 4000 под MacOS X
Поставить драйвера отсюда http://www.microsoft.com/hardware/en-us/d/natural-ergonomic-keyboard-4000 Потом
1 2 3 4 |
cd ~/Library/Preferences mv com.microsoft.keyboard.pref com.microsoft.keyboard.pref.bak wget http://scottbezek.com/com.microsoft.keyboard.pref open /Library/PreferencePanes/Microsoft\ Keyboard.prefPane |
http://blog.philippklaus.de/2012/05/microsoft-natural-ergonomic-keyboard-4000-with-mac-os-x-and-linux/
AngularJS: повтор последних запросов при обрыве соединения
Решил сделать кнопку «обновить», которая показывается при обрыве сетевого соединения и повторяет неудавшиеся запросы. Очень актуально для мобильных приложений.