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 | |
| // API access key from Google API's Console | |
| define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
| $registrationIds = array( $_GET['id'] ); | |
| // prep the bundle | |
| $msg = 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
| def downLoadImage(region, imageObj): | |
| s3 = boto3.resource('s3', region_name=region) | |
| bucketName = str(imageObj["Bucket"]) | |
| objectName = str(imageObj["Object"]) | |
| key = s3.Bucket(bucketName) \ | |
| .Object(objectName) | |
| saveFileName = '/tmp/'+objectName.replace('/', '__') | |
| s3.meta.client.download_file(bucketName, objectName, saveFileName) | |
| return saveFileName |
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
| String.prototype.format = String.prototype.f = function() { | |
| var s = this, | |
| i = arguments.length; | |
| var compareStr = ''; | |
| var map = {}; | |
| if ( (arguments.length == 1) && (typeof arguments[0] === 'object')) { | |
| for (var prop in arguments[0]) { | |
| key = prop; | |
| compareStr += key+'|'; | |
| map['{'+key+'}'] = arguments[0][prop]; |
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
| String.prototype.format = String.prototype.f = function() { | |
| var s = this, | |
| i = arguments.length; | |
| while (i--) { | |
| s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); | |
| } | |
| return s; | |
| }; | |
| //UseAge |
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 how you add a Jenkins slave | |
| # On master: | |
| sudo -u jenkins -H ssh-keygen | |
| # On slave | |
| adduser --system --group --home=/var/lib/jenkins-slave --no-create-home --disabled-password --quiet --shell /bin/bash jenkins-slave | |
| install -d -o jenkins-slave -g jenkins-slave /var/lib/jenkins-slave |
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
| filter { | |
| grok { | |
| match => { "message" => "^\[%{TIMESTAMP_ISO8601:datetime}\]\s+%{DATA:env}\s+%{LOGLEVEL:loglevel}+\:%{GREEDYDATA:log_msg}" } | |
| add_field => { | |
| "received_at" =>"%{datetime}" | |
| "enviroment" => "%{env}" | |
| "log_level" => "%{loglevel}" | |
| } | |
| } |
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 fs = require('fs'), | |
| http = require('http'), | |
| https = require('https'), | |
| express = require('express'), | |
| token = '', | |
| bodyParser = require('body-parser'), | |
| request = require('request'); | |
| var port = 443; |
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
| use \App\Model\ObjectForTest as ObjectForTest; | |
| class Main() { | |
| function test() { | |
| $ary = []; | |
| array_map(array('ObjectForTest', 'fun'), $ary); //回報錯誤 | |
| array_map(array('\App\Model\ObjectForTest', 'fun'), $ary); //正常 | |
| } | |
| } |
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="areaA"> | |
| <select ng-model="areaACountry" ng-options="citys for (citys, areaACountry) in zipCodes" ></select> | |
| <select ng-model="areaATown" | |
| ng-options="areas for (areas, zipcode) in areaACountry" ></select> | |
| </div> | |
| <div class="areaB"> | |
| <input type="checkbox" id="areaBAsAreaA" ng-checked="areaBAsAreaA()" />與AreaA相同內容<br /> | |
| <select ng-model="areaBCountry" ng-options="citys for (citys, areaBCountry) in zipCodes" ></select> | |
| <select ng-model="areaBTown" | |
| ng-options="areas for (areas, zipcode) in areaBCountry" ></select> |
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
| 1. find and add contacts by email or phone number (Important) | |