-
Style existing HTML rather than update HTML. Like, with bootstrap modal and buttons - better to use the default html and add style it with sass, because we can later use js components that will generate standard bootstrap elements and it will be hard to customize their HTML
-
Create CSS classes that will describe semantics of elements and not their appearance. It will help with redesign later. For example, we have all buttons in green color, instead of appending ".green" class to them, better to append "primary-button", and later if we want to make all buttons purple, we just have to change CSS instead of HTML
-
Change CSS is always more easy than change HTML. Because HTML later got split between dosens of components, but CSS(sass) is always in one place. Even more, HTML components can become reusable, and all too strict class naming will become a problem.
This file contains 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
$ cd ~ | |
$ sudo curl -sS https://getcomposer.org/installer | sudo php | |
$ sudo mv composer.phar /usr/local/bin/composer | |
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer | |
then you can run | |
$ sudo composer install |
#Main idea Big files with code are very hard to maintain. I suggest to limit files size to 100 +- rows, splitting hard logic to smaller parts and moving them to separate files
#PHP Controllers should serve just as buffer between HTTP interface and the app. They should define Actions and call methods defined in Models, Repositories, Services etc. Processing logic related to handling one single record can be moved to Model. Processing logic related to handling a set of records of one type can be moved to Repository. Logic related to a specific subject can be moved to a separate Service. Common functionalities can be moved to parent abstract classes.
This file contains 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
## run $ a2enmod expires | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access plus 1 year" |
This file contains 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
brew install npm | |
npm install phantom phantomjs -g |
This file contains 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 | |
$handle = fopen ("php://stdin","r"); | |
fscanf($handle,"%d",$t); | |
for($a0 = 0; $a0 < $t; $a0++){ | |
fscanf($handle,"%d %d",$n,$k); | |
$a_temp = fgets($handle); | |
$a = explode(" ",$a_temp); | |
array_walk($a,'intval'); | |
} |
0-2 are necessary only if we need a user another that root to run commands for ansible
- Create user to run ansible.
adduser test
passwd test
- make it possible to run commands as root without a password
This file contains 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
ar1 = gets.strip.split.map {|i| i.to_i} |
This file contains 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
--- # Install mariadb via ansible on centOS | |
- hosts: appserver | |
user: test | |
sudo: yes | |
vars: | |
mysql_root_password: passwd | |
tasks: | |
- name: Install MYSQL | |
yum: | |
name: mariadb-server #debian: mysql-server |
This file contains 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 | |
\DB::listen(function($sql, $bindings, $time) { | |
var_dump( vsprintf(str_replace("?", "'%s'", $sql), $bindings) ); | |
}); |
OlderNewer