const envs:any = {
dev: { region: 'eu-west-1', account: 'xxx' },
production: { region: 'eu-west-1', account: 'yyy' },
};
class MyApp extends cdk.Construct {
constructor(scope:any, id:any, props:any ) {
super(scope, id);
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
import λ from "apex.js"; | |
import { Pool } from "pg"; | |
// connection details inherited from environment | |
const pool = new Pool({ | |
max: 1, | |
min: 0, | |
idleTimeoutMillis: 120000, | |
connectionTimeoutMillis: 10000 | |
}); |
Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.
I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a
beforeEach
. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern
that gives great defaults for each test example but allows every example to override props
when needed:
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
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache | |
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache | |
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache |
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
brew tap homebrew/versions | |
brew install v8-315 | |
gem install libv8 -v '3.16.14.13' -- --with-system-v8 | |
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315 | |
bundle install |
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
launchctl unload -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist | |
launchctl load -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist |
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
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |
The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.
- Single Responsibility Principle: a class should have only a single responsibility
- Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
- Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
- Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
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
def assigns_local(key) | |
controller.instance_variable_get('@patched_locals')[key] | |
end | |
def patch_controller_render_to_support_locals(controller) | |
def controller.render(options = nil, extra_options = {}, &block) | |
[options, extra_options].select { |o| o.kind_of?(Hash) }.each do |option_hash| | |
if option_hash.include?(:locals) | |
@patched_locals = option_hash[:locals] | |
end |
NewerOlder