пятница, 25 сентября 2015 г.

Как подключить jquery на страницу сайта

http://www.stijit.com/javascript/podklyuchit-biblioteku-jquery

    В подключении jquery все просто. Есть 2 варианта:
  • Для работы оффлайн — скачать сам файл с библиотекой jQuery и подключить его
  • Для работы онлайн — быстро одной строчкой кода подключить jQuery из хранилища Google или Microsoft
У каждого варианта свои плюсы и минусы. Давайте рассмотрим их подробнее.

Подключение jquery через Google или Microsoft

Чтобы подключить последнюю версию jquery через Google нужно добавить одну строку кода внутри <head> — все предельно быстро и удобно:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Для подключения точной версии (в данном случае 1.11.0):
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
Точный номер последней версии всегда можно посмотреть здесь, а затем просто поменять эти цифры в коде и все будет работать.
Для подключения jquery через Microsoft добавляем код:
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.11.0.min.js"></script>
Подключение с Google хорошо тем, что многие сайты одинаково подключают jQuery — именно через Google API и всегда есть высокая вероятность того, что эта библиотека уже загружена в кэш браузера пользователя и не будет загружаться во второй раз.

Подключение jquery скачиванием файла с библиотекой

Подключаем jQuery со страницы своего сайта — это дольше, но надежнее. Для этого нужно:
скачать библиотеку jquery с официального сайта, сохранить в файл, назовем его jquery-1.11.0.min.js, положить в папку js на нашем сайте и добавить следующий код в <head>:
<script type="text/javascript" src="/js/jquery-1.11.0.min.js"></script>
В src задается путь где лежит наш файл с jquery, который нужно подключить на страницу сайта.
И, наконец, самый надежный и бронебойный вариант — подключение с Google, если Google недоступен — подключение со своего сайта:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
  document.write(unescape("%3Cscript src='/js/jquery-1.11.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
Или самый современный вариант — прописываем в <head> следующий код:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.11.0");
google.setOnLoadCallback(jQueryIsLoaded);
function jQueryIsLoaded() {
   alert('jQuery от Google загружен');
}
if (typeof jQuery == 'undefined') {
  document.write(unescape("%3Cscript src='/js/jquery-1.11.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>

четверг, 24 сентября 2015 г.

Сборка питона на git

https://github.com/collective/buildout.python

HTTPS clone URL

You can clone with 
, or 
 Clone in Desktop Download ZIP
Buildout all the Pythons
PythonShell
Branch: master 

 README.rst

Introduction

This buildout is a collection of configurations to make it easy to compile various Python versions with or without the necessary dependencies.
The default buildout.cfg configuration is for Mac OS X Leopard, because that's what this buildout was initially created for.

Installation

See docs/INSTALL.rst

Upgrade

See docs/UPGRADE.rst

Advanced Usage

The buildout is split up to make it easy to mix and match the parts you need.
If the links.cfg is used, then a script install-links is created in the bin directory. That script makes it easy to create symbolic links to all the binaries and scripts in this buildout. You should set the destination for those links by creating a local.cfg with the following content and run it withbin/buildout -c local.cfg after modifying the prefix setting to your needs:
[buildout]
extends = buildout.cfg

[install-links]
prefix = /path/for/the/links
The buildout is built in a way that you can easily extend it with your own configuration.
Just get a Git clone:
git clone git://github.com/collective/buildout.python.git python
And use a custom buildout.cfg like this:
[buildout]
extends = python/src/base.cfg python/src/python27.cfg
python-buildout-root = ${buildout:directory}/python/src
If you want just one python version but all dependencies, then use something like this:
[buildout]
extends =
  src/base.cfg
  src/readline.cfg
  src/libjpeg.cfg
  src/python25.cfg
  src/links.cfg

python-buildout-root = ${buildout:directory}/src

parts =
    ${buildout:base-parts}
    ${buildout:readline-parts}
    ${buildout:libjpeg-parts}
    ${buildout:python25-parts}
    ${buildout:links-parts}
The python-buildout-root setting is important, otherwise the whole buildout doesn't work.