notebook

Some random notes...

понедельник, 26 сентября 2011 г.

jQuery - check minimum version

To check whether jQuery is loaded to the page and verify minimum version:
if (typeof jQuery == 'undefined' || 
   !/[1-9]\.[3-9].[1-9]/.test($.fn.jquery)
) {
    throw('jQuery version 1.3.1 or above is required');
}
The regular expression determines the required jQuery version - /[X-9]\.[Y-9].[Z-9]/.
For example, for 1.3.1 use /[1-9]\.[3-9].[1-9]/, for 1.2.3 use /[1-9]\.[2-9].[3-9]/ etc.

Ярлыки:

понедельник, 26 октября 2009 г.

Portable Firefox & vimperator

Чтобы иметь возможность запуска Firefox с установленным vimperator из любой папки я использую такой bat-файл:

set HOME=%CD%
start Firefox\firefox.exe -profile profileSeb


Структура папок при этом такая:

.firefox
  Firefox
  profile-test
  profileSeb
  vimperator
  .vimperatorrc
  run.ff.bat


Папка.firefox - это корневая папка с портативным firefox.
В папке .firefox\Firefox находится установленный браузер.
Папки .firefox\profile-test и .firefox\profileSeb - это два профиля (для управления профилями нужно выполнить "firefox.exe -ProfileManager").
Папка .firefox\vimperator - это vimperator runtime (info, plugin, etc).
Файл .firefox\.vimperatorrc - настройки vimperator и .firefox\run.ff.bat - bat-файл для запуска firefox.


Для нормальной работы vimperator'а в bat-файле устанавливается переменная окружения %HOME%, после этого vimperator ищет файл настройки и папку runtime в текущей папке а не в папке пользователя.

После этого запускается firefox с моим основным профилем:

start Firefox\firefox.exe -profile profileSeb

Ярлыки: ,

воскресенье, 2 ноября 2008 г.

Firefox addons

UI
Vimperator - allows to interact with Firefox using (only) keyboard.
Mouse Gestures Redox - mouse gestures for Firefox.
Tabs open Relative - new tabs are opened near the current tab.
Russian spell dictionary, US English dictionary - dictionaries for spell checker.
ImgLikeOpera - ImgLikeOpera allows load only the images that you want in Firefox browser (no images / only from cache / only from current site / all).
GMarks - GMarks helps you sync & manage your bookmarks with Google Bookmarks.
Compact Menu 2 - turns Firefox main menu into a single button.
FoxyProxy - Extended proxy configuration.

Download control
FlashGot - Integration with external download managers.
DownThemAll - Internal Firefox download manager.
DownloadHelper - Downloads flv-videos from webpages.
Download Statusbar - View and manage downloads from a tidy statusbar - without the download window getting in the way of your web browsing.

Content control
Read It Later - This Firefox extension allows you to save pages of interest to read later.
Scrap Book - ScrapBook is a Firefox extension, which helps you to save Web pages and manage the collection.

Utils
No Script - protection against cross-site scripting.
Adblock Plus - blocks banners.
Flashblock - blocks flash objects.
Table2Clipboard - copy tables to clipboard as tables and not as junk.

Developement
PythonExt - This project provides Python Mozilla bindings that enables Python to be used inside of Mozilla applications.
Web Developer - a menu and a toolbar to the browser with various web developer tools.
DOM Inspector - document object model inspector.
HTML Validator - HTML Validator is a Mozilla extension that adds HTML validation inside Firefox and Mozilla.
Extension Developer - Testing JavaScript code, prototyping XUL layouts, and building XPI packages are all made easier by this extension.

Ярлыки: ,

Как остановить перезагрузку Windows XP

Для прерывания процесса перезагрузки системы нужно выполнить
shutdown -a.


Ярлыки:

суббота, 4 октября 2008 г.

.vimperatorrc - горячие клавиши в русской раскладке

Ниже - несколько полезных настроек для vimperator, в том числе: перемещение по закладкам с помощью стрелок или CTRL + h/l; перемещение самих закладок с помощью
SHIFT + стрелки или SHIFT + CTRL + h/l; и работающие клавиши vimperator'а при включенной русской раскладки.

Для хранения настроек vimperator использует файл .vimperatorrc, который должен находится в домашней папке. У меня на Windows XP - это "C:\Documents and Settings\User\.vimperatorrc".

Для того, чтобы в русской раскладке команды vimperator'а работали, необходимо,
чтобы текст .vimperatorrc был в кодировке UTF-8.

Текст файла .vimperatorrc:

" select next/previous tab
map <Right> gt
map <Left> gT
map <C-l> gt
map <C-h> gT

" move current tab left/right
map <S-Right> :tabmove! +1<CR>
map <S-Left> :tabmove! -1<CR>
map <C-L> :tabmove! +1<CR>
map <C-H> :tabmove! -1<CR>

" Russian language keyboard mappings (UTF-8)

map ё `
map й q
map ц w
map у e
map к r
map е t
map н y
map г u
map ш i
map щ o
map з p
map х [
map ъ ]
map ф a
map ы s
map в d
map а f
map п g
map р h
map о j
map л k
map д l
map ж ;
map э '
map я z
map ч x
map с c
map м v
map и b
map т n
map ь m
map б ,
map ю .
map Ё ~
map Й Q
map Ц W
map У E
map К R
map Е T
map Н Y
map Г U
map Ш I
map Щ O
map З P
map Х {
map Ъ }
map Ф A
map Ы S
map В D
map А F
map П G
map Р H
map О J
map Л K
map Д L
map Ж :
map Э "
map Я Z
map Ч X
map С C
map М V
map И B
map Т N
map Ь M
map Б <
map Ю >

Cкачать .vimperatorrc

Ярлыки: , ,

vimperator - основные команды

С чего начать
F1 - вызов справки
:set go=mT - вернуть меню и toolbar
(нажать :, в командной строке набрать set go=mT)

: - командная строка
/ - поиск на странице

o + url - перейти на url
t + url - перейти на url в новой закладке
d - закрыть закладку
u - отменить закрытие закладки
f - быстрые ссылки, переход в текущей закладке
(ссылки нумеруются, после ввода номера переходим по ссылке)
F - быстрые ссылки, переход в новую закладку

hjkl - прокрутка страницы лево/низ/верх/право
gg/G - перейти к началу / концу страницы
C-b/space - page up / page down
y - копировать url в буфер
p - вставить url из буфера

Список основных команд приведен ниже, кроме того, настройки для более удобного перемещения по открытым закладкам описаны здесь.


- Moving -
hjkl - лево/низ/верх/право
Space/C-b - scroll down/up by one page
C-d/C-u - scroll down/up by 1/2 page
gg - page top
G - page end
]f / [f - focus next|prev frame
gi - focus last input

- Zoom -
+ / - - zoom in|out

- History -
C-o/C-i - move Back/Forward in the history
H/L - -//-
:ju - history list for tab

- Tabs -
B - list tabs
:b index - go to tab №index

gt/C-n - go to the next tab
gT/C-p - go to the previous tab
g0/g$ - go to the first/last tab
d - close the active tab (delete the buffer)
u - undo close tab
:[count]tabd - Duplicates current tab [count] times

- Browsing -
o,:o - open
t,:t - tabopen
O = :open + current url
:open ~ - открыть домашнюю папку (file browser)
:open C: - открыть диск C:

p - open clipboard url
P - open clipboard url in a new tab

r - reload page
R - reload skipping cache
C-c - stop loading of current page

gu - go to parent directory
gU - go to root of website

f - hints for this page

F - hints for new tab
;{mode}{hint} - Start an extended hint mode.
; to focus a link and hover it with the mouse
a to save its destination (prompting for save location)
s to save its destination
o to open its location in the current tab
t to open its location in a new tab
O to open its location in an :open query
T to open its location in a :tabopen query
v to view its destination source
w to open its destination in a new window
W to open its location in a :winopen query
y to yank its destination location
Y to yank its text description
f to open its location in the current tab
F to open its location in a new tab


- Other -
[count]C-x - Decrements the last number in URL by 1, or by count if given.
[count]C-a - Increments the last number in URL by 1, or by count if given.

C-g - print file name
g C-g - print file info
:pa - page info

:w - save page

gf - view source
gF - view source in external editor

:!{cmd}
Run a command. Runs {cmd} through system() and displays its output.
Any '!' in {cmd} is replaced with the previous external command.
But not when there is a backslash before the '!', then that backslash is removed.

- Copy -
y - copy url to clipboard
Y - copy selection to clipboard
visual mode
i - Start caret mode. This mode resembles the Vim normal mode where you
see a text cursor and can move around. If you want to select text in
this mode, press v to start its Visual mode.
Нажимаем i ставим курсор куда нужно,
Потом - v - двигаем курсор, выделяется текст

--------------
:xall - command to quit and save the current browsing session for next time;
the default.
:qall - command to quit without saving the session
ZZ - normal mode mapping equivalent to :xall
ZQ - normal mode mapping equivalent to :qall

--------------
:cd [-|path] - Change the current directory. :cd - changes to the last directory.
:pw :pwd - Print the current directory name.

F1, :h - help
:viu - normal mode commands list
:exu - help on Ex commands

----------------

:dialog - To access some of Firefox's many dialog windows, :help :dialog
:bmarks - Vimperator provides a new interface to bookmarks
:history - It's exactly what it sounds like.
:addons
:downl - downloads

:dialog printpreview and :dialog printsetup
The "Print Preview" and "Page Setup" dialogs can be opened via the :dialog command

:emenu + команда (+tab - список) - доступ к главному меню firefox


:res[tart] - Force the browser to restart. Useful when installing extensions.

Disable vimperator
CTRL-Z
Disable all Vimperator keys except and pass them to the next event handler.
This is especially useful, if JavaScript controlled forms like the RichEdit form
fields of Gmail don't work anymore. To exit this mode, press .
If you also need to pass in this mode to the web page, prepend it with CTRL-V.

C-v CTRL-V
If you only need to pass a single key to a JavaScript form
field or another extension prefix the key with .
Also works to unshadow Firefox shortcuts like which are otherwise
hidden in Vimperator. When Vimperator mode is temporarily disabled
with , will pass the next key to Vimperator instead of the web page.


------ Settings -----------------------------
Настройки
$HOME/.vimperatorrc
Unix and Mac: ~/.vimperatorrc then ~/_vimperatorrc
Windows - ~/_vimperatorrc then ~/.vimperatorrc

:mkv[imperatorrc][!] [file]
Write current key mappings and changed options to [file].
If no [file] is specified then ~/.vimperatorrc is written unless
this file already exists. The special version :mkvimperatorrc!
will overwrite [file] if it exists.


:set go=mT - показать меню и тулбар

Ярлыки: , ,

Denwer - доступ по сети, настройка отправки почты

Для доступа к apache denwer'a по сети - дописать в httpd.conf:
Listen *:80
Для доступа к mysql по сети - закомментировать в \etc\scripts\init.d\mysql.pl
строку "--bind-address=127.0.0.1",

Отправка почты
По умолчанию почта складывается в \tmp\!sendmail.
Для реальной отправки почты нужно сделать так (в php.ini):
[mail function]
SMTP = mail.server.org
; sendmail_from = denwer@localhost ВАЖНО!!!!
; с mail'ом denwer@localhost ПИСЬМА НЕ ОТСЫЛАЮТСЯ!
sendmail_from = php@localhost.com

; sendmail_path = \usr\sbin\sendmail -t -i