Skip to content

Instantly share code, notes, and snippets.

View Tin-Nguyen's full-sized avatar

Tin Nguyen Tin-Nguyen

  • Unified
  • New York, USA
View GitHub Profile
version: '2'
services:
postgres:
image: postgres:9.6
container_name: postgres
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: postgres_password
POSTGRES_USER: postgres_user
CREATE TABLE jobs \
(id INT, \
configuration VARCHAR, \
extraParameters VARCHAR, \
jobInstanceId VARCHAR, \
network VARCHAR, \
duration INT,
durationUnit VARCHAR) \
WITH (KAFKA_TOPIC='jobs', \
VALUE_FORMAT='JSON', \
brand_id brand_name publisher lineitem_id media_budget end_date start_date days_remain is_5days_end lineitem_foreign_id lineitem_name adaccount_id adaccount_name actual_days_num avg_3day_media_spend yesterday_media_spent spent_today spent_through_yesterday budget_remaining_as_of_yesterday true_pacing_pct pacing_status_key pacing_status is_underpasing is_overpacing pacing_trend_pct spent_to_date budget_remain budget_complete_pct budget_at_risk avg_daily_spend_target open_media_budget open_media_budget_pct
0f543841-6eba-4029-9a34-d735215111df Spotify facebook 195dd03a-86cb-43e0-b5ac-7418c9dd1deb 100000000 2018-01-01 00:00:00 2017-01-01 00:00:00 -407 0 PM - Subs Evergreen 2 1437331579719236 PM - Subs Evergreen 2 3 0.00 0.00 0.00 0.00 100000000.00 0 1 Underpacing 1 0 0 0.00 100000000 0 100000000.00 0 0.00 0.00
{
"breakdowns": null,
"default_summary": true,
"action_attribution_windows": "['1d_view', '28d_click']",
"level": "ad",
"line_item_id": "5f6b9a02-ab27-4c6b-8a19-8652273c218f",
"fields": "reach,cpp,frequency,unique_actions,total_unique_actions,estimated_ad_recallers,cost_per_estimated_ad_recallers,estimated_ad_recall_rate,unique_inline_link_clicks,video_avg_percent_watched_actions,video_avg_time_watched_actions,canvas_avg_view_time,canvas_avg_view_percent,unique_clicks,unique_inline_link_click_ctr,cost_per_unique_inline_link_click",
"ids": "23842713111030454,23842713111100454,23842713111110454,23842713111120454,23842713111130454,23842713111140454,23842713111150454,23842713111160454,23842713111170454,23842713111180454,23842713111190454,23842713111200454,23842713111210454,23842713111220454,23842713111230454,23842713111240454,23842713111250454,23842713111260454,23842713111270454,23842713111280454,23842713111290454,23842713111300454,23842713111310454,23842713111320454,23842713111330454,
it('should dispatch action', (done) => {
const getState = {}
const action = { type: 'ADD_TODO' }
const expectedActions = [action]
const store = mockStore(getState, expectedActions, done)
store.dispatch(action)
})
it('should set token', () => {
const nextState = reducer(undefined, {
type: USER_SET_TOKEN,
token: 'my-token'
})
// immutable.js state output
expect(nextState.toJS()).to.be.eql({
token: 'my-token'
})
it('simulates click events', () => {
const onButtonClick = sinon.spy()
const wrapper = shallow(
<Foo onButtonClick={onButtonClick} />
)
wrapper.find('button').simulate('click')
expect(onButtonClick.calledOnce).to.be.true
})
const LatestPostsComponent = props => {
const postPreviews = renderPostPreviews(props.posts);
return (
<section>
<div><h1>Latest posts</h1></div>
<div>
{ postPreviews }
</div>
</section>
// bad
{
isTrue
? <p>True!</p>
: <none/>
}
// good
{
isTrue &&
// bad
componentWillMount() {
this.setState({
computedFoo: compute(this.props.foo)
});
},
componentWillReceiveProps(nextProps) {
this.setState({
computedFoo: compute(nextProps.foo)
});