Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| # no config | |
| Time.now is localtime | |
| 1.second.from_now is UTC | |
| Timestamp stored in UTC | |
| AR not translated | |
| Time.now: Fri Aug 24 10:22:25 +0930 2012 | |
| 1.second.from_now 2012-08-24 00:52:26 UTC |
| # extension for string class | |
| class String | |
| # return character array of string with indices | |
| def each_char_with_index | |
| i = 0 | |
| split(//).each do |c| | |
| yield i, c | |
| i += 1 | |
| end | |
| end |
| http { | |
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
| proxy_temp_path /var/tmp; | |
| include mime.types; | |
| default_type application/octet-stream; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| gzip on; | |
| gzip_comp_level 6; |
| Promise.any = function(arrayOfPromises) { | |
| // For each promise that resolves or rejects, | |
| // make them all resolve. | |
| // Record which ones did resolve or reject | |
| var resolvingPromises = arrayOfPromises.map(function(promise) { | |
| return promise.then(function(result) { | |
| return { | |
| resolve: true, | |
| result: result | |
| }; |
| // create an IAM Lambda role with access to dynamodb | |
| // Launch Lambda in the same region as your dynamodb region | |
| // (here: us-east-1) | |
| // dynamodb table with hash key = user and range key = datetime | |
| console.log('Loading event'); | |
| var AWS = require('aws-sdk'); | |
| var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'}); | |
| exports.handler = function(event, context) { |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| var BatchStream = require('batch-stream2') | |
| var gulp = require('gulp') | |
| var coffee = require('gulp-coffee') | |
| var uglify = require('gulp-uglify') | |
| var cssmin = require('gulp-minify-css') | |
| var bower = require('gulp-bower-files') | |
| var stylus = require('gulp-stylus') | |
| var livereload = require('gulp-livereload') | |
| var include = require('gulp-include') | |
| var concat = require('gulp-concat') |
| it("should render a text box with no string inside if search string is not provided by store", () => { | |
| const testState = { | |
| showBox: { | |
| search: "" | |
| } | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| component.dive().find("form > div > input").simulate("change", { target: { value: "Site" } }); |
| describe('ConnectedShowBox', () => { | |
| it("should render successfully if string is not provided by store", () => { | |
| const testState = { | |
| showBox: {} | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| expect(component).to.be.a('object'); | |
| }); | |
| }); |
| import React from 'react' | |
| import PropTypes from 'prop-types' | |
| import { connect } from 'react-redux' | |
| import { submitValue } from '../store/modules/showBox' | |
| export class ShowBox extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| searchString: this.props.search || "" |