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
| sudo gem install compass -n /usr/local/bin | |
| cd public | |
| compass create styleSheets | |
| ls | |
| css styleSheets | |
| cd styleSheets | |
| /Applications/MAMP/htdocs/elasticsearch/public/styleSheets |
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 | |
| https://www.yiiframework.com/extension/csvexport | |
| Yii::import('ext.ECSVExport'); | |
| // for use with array of arrays | |
| $data = array( | |
| array('key1'=>'value1', 'key2'=>'value2') | |
| .... | |
| ) |
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"?> | |
| <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
| <CORSRule> | |
| <AllowedOrigin>*</AllowedOrigin> | |
| <AllowedMethod>GET</AllowedMethod> | |
| <AllowedMethod>PUT</AllowedMethod> | |
| <AllowedMethod>POST</AllowedMethod> | |
| <AllowedMethod>DELETE</AllowedMethod> | |
| <MaxAgeSeconds>3000</MaxAgeSeconds> | |
| <AllowedHeader>*</AllowedHeader> |
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 | |
| $fields = ['id', 'availability', 'condition', 'description', 'image_link', 'link', 'title', 'price', 'currency']; | |
| var_dump(isset($fields['id'])); | |
| var_dump(isset($fields[0])); | |
| var_dump(in_array('id', $fields)); | |
| bool(false) | |
| bool(true) | |
| bool(true) |
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
| class Validator extends CFormModel | |
| { | |
| public $id; | |
| public function rules() | |
| { | |
| return [ | |
| [['id'], 'required'], | |
| ['id', 'length', 'max' => 50], | |
| ['price', 'validatePrice'], |
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
| error_reporting(-1); | |
| ini_set('display_errors', 'On'); |
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
| var mappingData = {}; | |
| mappingData[MASTER_PLATFORM_ID] = data; | |
| formData.append('mapping_data', JSON.stringify(mappingData)); | |
| https://www.w3schools.com/js/js_json_stringify.asp |
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
| /** | |
| * Get data from S3 as Stream Wrapper | |
| * @param $catalogId | |
| * @param $fileName | |
| * @param bool $headerOnly | |
| * @param int $numRow | |
| * @return array | |
| */ | |
| public function getContentCsvS3($catalogId, $fileName, $headerOnly = false, $numRow = 0) { | |
| $s3Client = S3Client::factory(array('key' => S3KEY_FEED, 'secret' => S3SECRET_FEED)); |
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 file_get_contents_chunked($file,$chunk_size,$callback) | |
| { | |
| try | |
| { | |
| $handle = fopen($file, "r"); | |
| $i = 0; | |
| while (!feof($handle)) | |
| { | |
| call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i)); | |
| $i++; |
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 loadScript( url, callback ) { | |
| var script = document.createElement( "script" ) | |
| script.type = "text/javascript"; | |
| if(script.readyState) { //IE | |
| script.onreadystatechange = function() { | |
| if ( script.readyState === "loaded" || script.readyState === "complete" ) { | |
| script.onreadystatechange = null; | |
| callback(); | |
| } | |
| }; |