Skip to content

Instantly share code, notes, and snippets.

View rrharvey's full-sized avatar

Ryan Harvey rrharvey

  • Intertech
  • Eagan MN
View GitHub Profile
import * as React from 'react';
import * as classNames from 'classnames';
interface DropdownProps {
text: string;
rightAlign?: boolean;
}
class Dropdown extends React.Component<DropdownProps, null> {
constructor() {
@rrharvey
rrharvey / typescriptreact.json
Last active May 22, 2017 18:47
Visual Studio Code snippets for React using TypeScript
{
"Import React": {
"prefix": "impr",
"body": [
"import * as React from 'react';",
"$0"
]
},
"Import ReactDOM": {
"prefix": "imprd",
@rrharvey
rrharvey / components.js
Last active March 3, 2017 16:01
Object spread operator in JSX
const LabelValue = props => <div>{props.label}: {props.value} ({props.note})</div>;
const ComponentOne = props => {
const label = 'Label';
const someValue = 'Value';
const note = 'Lorem ipsum dolor sit amet';
return <LabelValue {...{
label,
value: someValue,
@rrharvey
rrharvey / CustomSwagger.js
Last active May 5, 2019 09:39
Add bearer token to Swagger UI using Swashbuckle
(function () {
$(function () {
$('#input_apiKey').attr('placeholder', 'JSON Web Token');
$('#input_apiKey').off();
$('#input_apiKey').on('change', function () {
var key = this.value;
console.info('Set bearer token to: ' + key);
if (key && key.trim() !== '') {
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer " + key, "header"));
}
@rrharvey
rrharvey / gist:7678052
Created November 27, 2013 15:57
This example shows how to add script elements automatically that will be processed using grunt-usemin. This example uses the html and Gruntfile.js from the AngularJS generator for Yeoman. The default for mode for grunt-file-blocks is to add newly discovered files only. Once a script element has been added you can move the lines around inside the…
<!-- ... content removed -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<!-- fileblock:js scripts -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<!-- endfileblock -->
<!-- endbuild -->
</body>
</html>