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
#!/bin/bash | |
# | |
# npm install all required packages | |
# example usage | |
# | |
# ./install-required-packages.sh gulpfile.sh --save-dev | |
# ./install-required-packages.sh gulpfile.sh --save | |
# ./install-required-packages.sh gulpfile.sh | |
# | |
# TODO: this matches require's that are commented out. Fix. |
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
replacejs() { | |
FOLDER_NAME=$(basename $1 | sed 's/\.js\(x\)\{0,1\}$//') | |
FOLDER=$(dirname $1)/$FOLDER_NAME | |
SUFFIX=$(basename $1 | sed 's/.*\.//') | |
mkdir $FOLDER | |
mv $1 $FOLDER/index.$SUFFIX | |
} | |
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
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())); |
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
// 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'); |
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 { 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 |
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 { 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 |
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
// 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} |
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 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) |
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
{ | |
match page { | |
Page::Search(search_api_call) => ... | |
} | |
} |
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
{ | |
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>), |
OlderNewer