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
posts = Post.where(id: [1, 2, 3]) | |
# SELECT * FROM posts WHERE id IN (1, 2, 3) | |
users = posts.map { |post| post.user } | |
# SELECT * FROM users WHERE id = 1 | |
# SELECT * FROM users WHERE id = 2 | |
# SELECT * FROM users WHERE id = 3 |
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
# Javascript Node CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | |
# | |
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/node:7.10 |
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
#!/bin/sh | |
echo "Running deploy script..." && | |
cd src && | |
version_description=`git log --oneline -1 | cat` && # e.g. ec2ab6f My commit message | |
echo "Pushing code..." && | |
clasp push && | |
echo "Creating new version: $version_description" && | |
version_number=`clasp version "$version_description" | grep -o '[0-9][0-9]*' | tail -1` && | |
echo "Created version $version_number" && |
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
# Javascript Node CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | |
# | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/node:7.10 |
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
module.exports = { | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jest/globals": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"sourceType": "module", | |
"ecmaVersion": 2017 |
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
const DateUtils = require('../src/DateUtils.js'); | |
test('getDatePart', () => { | |
const date = new Date('2018-07-09'); | |
expect(DateUtils.getDatePart(date)).toBe('2018-07-09'); | |
}); |
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
var DateUtils = { | |
/* | |
* Converts Date object to a String containing the date part (with dashes). | |
* | |
* @return {String} Date part. E.g. '2018-07-10'. | |
*/ | |
getDatePart: function(dateObject) { | |
return dateObject.toISOString().slice(0, 10); | |
} | |
} |
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
/** | |
* Constructor for DataCache. | |
* More info on caching: https://developers.google.com/apps-script/reference/cache/cache | |
* | |
* @param {object} cacheService - GDS caching service | |
* @param {Date} startDate - beggining of GDS request interval | |
* @param {Date} endDate - end of GDS request interval | |
* | |
* @return {object} DataCache. | |
*/ |
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
//... | |
function getData(request) { | |
// ... | |
var startDate = request.dateRange.startDate; | |
var endDate = request.dateRange.endDate; | |
var cache = new DataCache(CacheService.getUserCache(), startDate, endDate); | |
var plays = null; |
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
/** | |
* Constructor for DataCache. | |
* More info on caching: https://developers.google.com/apps-script/reference/cache/cache | |
* | |
* @param {object} cacheService - GDS caching service | |
* @param {Date} startDate - beggining of GDS request interval | |
* @param {Date} endDate - end of GDS request interval | |
* | |
* @return {object} DataCache. | |
*/ |