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
// Yii 1 | |
Yii::app()->request->getParam('q'); | |
// Yii 2? | |
Yii::$app->request->post('var'); | |
Yii::$app->request->get('var'); |
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
// Actions | |
const ACTION_1 = "my-app/social/ACTION_1"; | |
// Dispatchers | |
export const dispatcher_1 = (data) => { | |
return (dispatch, getState) => { | |
dispatch({ type: ACTION_1, payload: data }); | |
}; | |
}; |
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
.masonry { | |
column-count: 3; | |
column-gap: 1em; | |
} | |
.masonry .item { | |
background-color: #eee; | |
display: inline-block; | |
margin: 0 0 1em; | |
width: 100%; |
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
// array_deep_column($wallData->items, 'likes.count'); | |
function array_deep_column($array, $path) | |
{ | |
$currentArray = $array; | |
$path = explode('.', $path); | |
foreach ($path as $sub) { | |
if (is_object($currentArray)) { | |
$currentArray = get_object_vars($currentArray); | |
} |
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 --ini | grep "Loaded Configuration File" |
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 --ini | grep "extension_dir" |
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 force the link and overwrite all conflicting files: | |
brew link --overwrite node |
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
// Usage: | |
// await Files.write('test.json', JSON.stringify(data)); | |
const fs = require('fs'); | |
class Files { | |
static write(fname, data) { | |
return new Promise((resolve, reject) => { | |
fs.writeFile(`./${fname}`, data, (err) => { | |
if (err) { |
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
// Usage: detectCity("Я живу в Москве"); // return "Москва" | |
function detectCity($text) | |
{ | |
$cities = [ | |
// Россия | |
// Миллионники | |
'Москва' => ['моск', 'msk', 'moskva', 'moscow', 'столица'], | |
'Санкт-Петербург' => ['петербург', 'peterburg', 'petersburg'], | |
'Волгоград' => ['волгоград', 'volgograd'], |
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
<div class="photos-line"> | |
<div class="photo"> | |
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/e35/22860491_293564051135946_1431999210961502208_n.jpg"> | |
</div> | |
<div class="photo"> | |
<img src="https://scontent.cdninstagram.com/t51.2885-15/s640x640/e35/23347493_138848026766173_4147715403113562112_n.jpg"> | |
</div> | |
<div class="photo"> | |
<img src="https://scontent.cdninstagram.com/t51.2885-15/e35/p320x320/23498171_1512204415482005_7319427710441226240_n.jpg"> | |
</div> |