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
| import org.slf4j.Logger | |
| import org.slf4j.LoggerFactory | |
| import ratpack.handling.Context | |
| import ratpack.handling.Handler | |
| import ratpack.http.client.HttpClient | |
| import ratpack.http.client.StreamedResponse | |
| import ratpack.http.MutableHeaders | |
| import ratpack.http.client.RequestSpec | |
| import static ratpack.groovy.Groovy.ratpack |
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
| package utils | |
| import groovy.json.JsonBuilder | |
| import groovy.json.JsonSlurper | |
| class HDD { | |
| static save(Object content, String filePath) { | |
| new File(filePath).write(new JsonBuilder(content).toPrettyString()) | |
| } |
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
| @Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='1.1.0') | |
| @Grab(group='joda-time', module='joda-time', version='2.7') | |
| import wslite.rest.* | |
| import org.joda.time.* | |
| import org.joda.time.format.* | |
| import groovy.xml.* | |
| import groovy.json.* | |
| import static java.lang.System.* | |
| import groovy.transform.* |
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
| [ | |
| {name: 'Afghanistan', code: 'AF'}, | |
| {name: 'Åland Islands', code: 'AX'}, | |
| {name: 'Albania', code: 'AL'}, | |
| {name: 'Algeria', code: 'DZ'}, | |
| {name: 'American Samoa', code: 'AS'}, | |
| {name: 'AndorrA', code: 'AD'}, | |
| {name: 'Angola', code: 'AO'}, | |
| {name: 'Anguilla', code: 'AI'}, | |
| {name: 'Antarctica', code: 'AQ'}, |
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 script will automatically sync all updates from one database to another. It is meant to be run while | |
| * syncing the database using mongodump and mongorestore. | |
| * | |
| * Example: | |
| * node index.js mongodb://<user>:<pass>@dbhost.com:10645/app-production \ | |
| * mongodb://<user>:<pass>@dbhost.com:10499/local?authSource=app-production \ | |
| * app-production \ | |
| * mongodb://<user>:<pass>@newdbhost.com/app-prod | |
| */ |
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
| @PropertySource("classpath:/com/myco/app.properties") | |
| @Configuration | |
| public class ApplicationConfig { | |
| @Autowired | |
| Environment env; | |
| //... | |
| @Bean |
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
| #!groovy | |
| # Best of Jenkinsfile | |
| # `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
| 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
| // Build Netty SslContext | |
| SslContext sslContext = SslContextBuilder | |
| .forClient() | |
| // ... | |
| .build(); | |
| // Initialize ReactorClientHttpConnector with SslContext | |
| WebClient.create(new ReactorClientHttpConnector(opts -> opts.sslContext(sslContext))); |
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
| // filename: components/CustomComponent/index.test.js | |
| import React from 'react'; | |
| // Don't use component actual name, in this way | |
| // when you rename the component, no test change is required | |
| import Component from './index'; | |
| describe(Component.name, () => { | |
| // Use SUD (system under test) component for the tests | |
| // in this way each test contains only the props, specific to this test |
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
| /** | |
| * server/dataSources/Auth.js | |
| * Auth implementation, it's not really a dataSource so it doesn't need to be here | |
| */ | |
| const { authenticate, createJwt } = require('../lib/passport'); | |
| const { ON_HTTPS } = require('../configs'); | |
| const ONE_MINUTE = 1000 * 60; | |
| const ONE_DAY = ONE_MINUTE * 60 * 24; | |
| const ONE_MONTH = ONE_DAY * 30; |
OlderNewer