function get_stat( $url, $headers )
{
$handle = curl_init();
curl_setopt( $handle, CURLOPT_URL, $url );
curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
$response = curl_exec( $handle );
$code = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
return array( "code" => $code, "response" => $response );
}
$url_yandex_disk = "https://yadi.sk/i/byMUqoSLiw3Ki";
$result = get_stat( "https://cloud-api.yandex.net:443/v1/disk/public/resources/download?public_key=" . urlencode( $url_yandex_disk ), array() );
if( $result["code"] == 200 )
{
$result["response"] = json_decode( $result["response"], true );
echo '<a href="' . $result["response"]["href"] . '">Скачать</a>';
}
else
{
echo "error";
}
$url_yandex_disk = $_GET["ya_url"];
$result = get_stat( "https://cloud-api.yandex.net:443/v1/disk/public/resources/download?public_key=" . urlencode( $url_yandex_disk ), array() );
if( $result["code"] == 200 )
{
$result["response"] = json_decode( $result["response"], true );
header( "Location: " . $result["response"]["href"], true, 302 );
exit( 0 );
}
import requests
import pprint
import urllib.parse
targetUrl = "https://yadi.sk/i/03bE933n3PqpG2"
url = "https://cloud-api.yandex.net/v1/disk/public/resources?public_key=" + urllib.parse.quote(targetUrl, safe="")
responseData = requests.get(url)
if responseData.headers["content-type"] in ["application/json; charset=utf-8", "application/json"]:
print(pprint.pformat(responseData.json()))
else:
print(responseData)
css
или js
файлов, которое вы подключаете на своих страницах посредством тэгов <link>
и <src>
. ymaps.ready(function () {
ymaps.geolocation.get({
provider: 'yandex'
}).then(function (result) {
var coords = result.geoObjects.get(0).geometry.getCoordinates();
/*map — ссылка на карту Google*/
map.setCenter(new google.maps.LatLng(coords[0], coords[1]));
});
});
# app/workers/hard_worker.rb
class HardWorker
include Sidekiq::Worker
def perform(name, count)
puts 'Doing hard work'
end
end
HardWorker.perform_async('bob', 5)
# Use Capistrano for deployment
group :development do
gem 'capistrano'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
gem 'capistrano-passenger'
gem 'capistrano-bower'
end
bundle exec cap install
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/bower'
require 'capistrano/passenger'
# config valid only for current version of Capistrano
lock '3.3.5'
set :application, 'my_awesome_site'
set :repo_url, 'git@bitbucket.org:username/my_awesome_site.git'
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/home/user/www/#{fetch(:application)}"
# Default value for :scm is :git
set :scm, :git
role :app, %w{myhosting.ru}
role :web, %w{myhosting.ru}
role :db, %w{myhosting.ru}
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server 'myhosting.ru', user: 'user', roles: %w{web app db}
set :rails_env, 'production'
set :rvm_type, :user # Defaults to: :auto
set :rvm_ruby_version, '2.1.4@r4' # Defaults to: 'default'
bundle exec cap production deploy:check
и долго долго делать bundle exec cap production deploy
отлавливая ошибки деплоя и исправляя их :)server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri; # enforce https
# rewrite ^(.*) https://www.example.com$uri permanent;
}