Credits:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init();" frameRate="30"> | |
| <mx:Script> | |
| <![CDATA[ | |
| import mx.core.UIComponent; | |
| private var _connection : NetConnection; | |
| private var _stream : NetStream; | |
| private var _video : Video; | |
| private var _bitmapArray:Array = new Array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "net/http" | |
| # Example Usage: | |
| # | |
| # use Rack::Proxy do |req| | |
| # if req.path =~ %r{^/remote/service.php$} | |
| # URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}") | |
| # end | |
| # end | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is the root of our app | |
| @root = File.expand_path(File.join(File.dirname(__FILE__), "www")) | |
| run Proc.new { |env| | |
| # Extract the requested path from the request | |
| req = Rack::Request.new(env) | |
| index_file = File.join(@root, req.path_info, "index.html") | |
| if File.exists?(index_file) | |
| # Rewrite to index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put me in config/initializers/rdiscount.rb | |
| class ActionView::Template | |
| class RDiscountHandler < Handler | |
| def self.erb_handler | |
| @@erb_handler ||= ActionView::Template.registered_template_handler(:erb) | |
| end | |
| def self.call(template) | |
| compiled_source = erb_handler.call(template) | |
| "::RDiscount.new(begin;#{compiled_source};end).to_html" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function A(x) { this.x = x; }; | |
| function B(x,y) { A.call(this, x); this.y = y; }; | |
| B.prototype = new A(); | |
| B.prototype.what = function(){ return "hello"; }; | |
| var d = new B(5, 10); | |
| A.prototype.say = function(){return "say " + this.what();}; | |
| B.prototype.say = function(){return ">> : " + A.prototype.say.call(this);}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM php:7.0-apache | |
| RUN apt-get update && apt-get install -y \ | |
| git-core \ | |
| ssh-client \ | |
| unzip \ | |
| --no-install-recommends && rm -r /var/lib/apt/lists/* | |
| # Install composer bin to /usr/local/bin | |
| RUN curl -sS https://getcomposer.org/installer | \ |
Let's say you have a ruby project. You write tests using rspec and you write documentation inside the code. And you are using awesome GitLab to host your git repo, run CI pipelines and store your docker images in registry.
First we need to build an image. But we want to leverage docker layer caching, because libraries (rubygems) doesn't update very often. That's why we do docker pull first, and docker build --cache-from after.
If you make a feature branch and update some libraries, you can't use layer with libraries form the master branch. That's why we try to docker pull for feature branch first, and docker pull for master branch after.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Напишите функцию intervals так, чтобы все тесты выполнились | |
| * и в конце на экран было выведено 'OK' | |
| * | |
| * Функция принимает на вход отсортированный массив чисел, | |
| * на выходе — массив интервалов, где интервал это массив из двух | |
| * элементов, начало и конец интервала. | |
| */ |
OlderNewer