Skip to content

Instantly share code, notes, and snippets.

💭
why does github have statuses?

Robert Balicki rbalicki2

💭
why does github have statuses?
  • Jetty
  • NYC
Block or report user

Report or block rbalicki2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View match-example.rs
{
match page {
Page::Search(search_api_call) => ...
}
}
View rendering-the-api-call.rs
{
search_api_call_opt.as_ref().map(|ref mut search_api_call| {
match &mut *search_api_call.borrow_mut() {
PromiseState::Success(search_results) => {
let search_results = search_results.clone();
render_search_results(search_results, |track_id| {
page.go_to_detail_view(track_id);
})
},
PromiseState::Pending => smd!(<p>Loading</p>),
View promise-state-example.rs
match & *unwrapped_promise.borrow() {
smithy::types::PromiseState::Success(val) => {
let val = val.clone();
smd!({ &mut val })
},
// ...
}
View Form.js
import React from 'react';
import { Form } from 'react-final-form';
export default ({ render, transform, ...rest })=> <Form
{...rest}
render={({ values, ...renderPropsRest }) => render({ values: transform(values), ...renderPropsRest })}
/>;
// the function passed to transform is x => MyModelSubclass.getFromCache(x)
View gist:b125a403cb327738b35d6a6e42a0191f
// the following two are equivalent:
// First
let my_app = smd!(
on_hash_change={on_hash_change_callback};
post_render={post_render_callback};
// comments can go anywhere
{ interpolated_item }
<div
ref={&mut my_ref}
@rbalicki2
rbalicki2 / Resolve.jsx
Created Nov 14, 2018
Resolve.jsx (the one in use)
View Resolve.jsx
import { Component } from 'react';
import PropTypes from 'prop-types';
/**
* Resolve
*
* This is the workhorse of how Jetty does async.
* It accepts a promise, and renders one of four render props:
* - before
* - pending
View Resolve.jsx
import { Component } from 'react';
import PropTypes from 'prop-types';
/**
* Resolve
*
* This is the workhorse of how Jetty does async.
* It accepts a promise, and renders one of four render props:
* - before
* - pending
@rbalicki2
rbalicki2 / QuoteOption.rs
Created May 7, 2018
QuoteOption, possibly updated for nightly
View QuoteOption.rs
use quote::{Tokens, ToTokens};
use proc_macro2::{Term, Span, Group, Delimiter, TokenStream};
pub struct QuoteOption<T>(pub Option<T>);
impl<T> ToTokens for QuoteOption<T>
where T: ToTokens
{
fn to_tokens(&self, tokens: &mut Tokens) {
// tokens.append(Term::new("{", Span::call_site()));
View rollup.config.js
// this is the top-level rollup config
//
// each child rollup config *must* use full paths, e.g.
// const DESTINATION_FILE = path.join(__dirname, '..', 'lib/index.js');
// const INPUT_FILE = path.join(__dirname, '..', 'src/index.js');
const requireGlob = require('require-glob');
const path = require('path');
const _ = require('lodash');
View How we use cloudfront and next.js.md

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

You can’t perform that action at this time.