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 | |
| /** | |
| * Class for manipulating files bigger than 2GB | |
| * (currently supports only getting filesize) | |
| * | |
| * @author Honza Kuchař | |
| * @license New BSD | |
| * @encoding UTF-8 | |
| * @copyright Copyright (c) 2013, Jan Kuchař |
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 ubuntu:14.04 | |
| MAINTAINER Slava Konashkov <[email protected]> | |
| # Install packages | |
| ENV DEBIAN_FRONTEND noninteractive | |
| RUN apt-get update && \ | |
| apt-get install -y software-properties-common && \ | |
| LANG=C.UTF-8 add-apt-repository ppa:ondrej/php5-5.6 && \ | |
| apt-get update && \ | |
| apt-get -y install supervisor apache2 libapache2-mod-php5 mysql-server php5-mysql pwgen php-apc php5-mcrypt && \ |
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
| ########################################## | |
| # To run: | |
| # curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x | |
| ########################################## | |
| # Check that HTTPS transport is available to APT | |
| if [ ! -e /usr/lib/apt/methods/https ]; then | |
| sudo apt-get update | |
| sudo apt-get install -y apt-transport-https | |
| fi |
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
| http://fabien.potencier.org/article/49/what-is-symfony2 | |
| https://www.youtube.com/watch?v=hqQSN1ndKA8 -- DDD | |
| https://plugins.jetbrains.com/plugin?pr=&pluginId=7219 -- phpStorm sf2 plugin | |
| app/console router:debug | |
| http://rad.knplabs.com/ -- Rapid Application Development for Symfony2 (do not use yet) | |
| === Symfony_best_practices | |
| https://www.youtube.com/watch?v=Fu9j7w2hbW8 | |
| http://symfony.com/pdf/Symfony_best_practices_2.6.pdf?v=4 |
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
| // It's OK | |
| public static function getInstance() { | |
| static $_instance = null; | |
| return $_instance ?: $_instance = new self(); | |
| } | |
| // It's Error (Parse error: syntax error, unexpected 'new' (T_NEW)) | |
| public static function getInstance() { | |
| static $_instance = new self(); | |
| return $_instance; |
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
| public class Main { | |
| /** | |
| * - Всеволод! У меня тут в программе 100 ошибок! не проходит валидацию! | |
| * - Попробуй решить их через регулярные выражения. | |
| * - Всеволод, у меня теперь в программе 101 ошибка! | |
| */ | |
| final static String sUrlRegex = "^(https?|ftp|file)://([a-z\\.-_]+/)+(\\??[a-z0-9]+=[a-z0-9]+\\&?)*"; | |
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
| import java.util.Random; | |
| public class Main { | |
| private static Random random = new Random(); | |
| public static String randName() { | |
| StringBuilder sb = new StringBuilder(); | |
| int max = random.nextInt(20); | |
| sb.append((char) (65 + random.nextInt(26))); |
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
| package cycles; | |
| public class Snowflake { | |
| public static void main(String[] args) { | |
| int iLen = 10; | |
| char[][] arrSnow; | |
| arrSnow = makeSnowflake(iLen); | |
| showSnowflake(arrSnow); | |
| } |
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
| package cycles; | |
| import java.util.Arrays; | |
| public class Reduce { | |
| public static void main(String[] args) { | |
| int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
| while (a.length > 3) { | |
| a = reduce(a); | |
| } |
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
| package cycles; | |
| import java.util.Arrays; | |
| public class ReverseArray { | |
| public static void main(String[] args) { | |
| int[] a = {1,2,3,4,5}; | |
| int[] b = {1,2,3,4,5,6}; | |
| System.out.println(Arrays.toString(reverse(a))); |