Skip to content

Instantly share code, notes, and snippets.

Samuel engineersamuel

Block or report user

Report or block engineersamuel

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 index.snippet.html
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: 'http://localhost:7071/api/swagger/openapi.json', oauth2RedirectUrl: 'http://localhost:7071/api/swagger/oauth2-redirect.html',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
View local.settings.json
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
View swaggerSnippet.js
const ui = SwaggerUIBundle({
url: "",
View Swagger.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using CseApi.Functions.Shared;
using CseApi.Helpers.Config;
using CseApi.Helpers.Http;
using Microsoft.AspNetCore.Http;
engineersamuel / event.hooks.js
Created May 21, 2018
Webpack event hook to rewrite index.html
View event.hooks.js
new EventHooksPlugin({
'afterEmit': () => {
const hashedIndexHtml = glob.sync(`${paths.appBuild}/*.html`)[0];
const hash = /index\.(.*?)\.html/.exec(hashedIndexHtml)[1];
const webConfig = fs.readFileSync(`${paths.appBuild}/web.config`).toString();
const result = webConfig.toString().replace(/index\.html/g, `index.${hash}.html`);
fs.writeFileSync(`${paths.appBuild}/web.config`, result);
engineersamuel / web.config.xml
Created May 21, 2018
Azure IIS static web.config
View web.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<add value="index.html" />
View action_reducer_do_this.ts
interface IActionUpdateProductNameVersion {
productName: string;
productVersion: string;
const requestUpdateProductVersion = createAction<interfaces.IActionUpdateProductNameVersion, void>(types.REQUEST_UPDATE_PRODUCT_VERSION,
(productName: string, productVersion: string) => ({productName, productVersion}),
const receiveUpdateProductVersion = createAction<interfaces.IActionUpdateProductNameVersion, interfaces.IMetaIsXhrError>(types.RECEIVE_UPDATE_PRODUCT_VERSION,
View avoid_action_reducer.ts
interface IActionProductName { productName: string; }
interface IActionProductVersion { productVersion string; }
const requestUpdateProductVersion = createAction<interfaces.IActionProductName & interfaces.IActionProductVersion, void>(types.REQUEST_UPDATE_PRODUCT_VERSION,
    (productName: string, productVersion: string) => ({productName, productVersion}),
const receiveUpdateProductVersion = createAction<interfaces.IActionProductName & interfaces.IActionProductVersion, interfaces.IMetaIsXhrError>(types.RECEIVE_UPDATE_PRODUCT_VERSION,
    (productName: string, productVersion: string) => ({productName, productVersion}),
View nestedPromises.ts
function checkAuth(forceError: boolean): Promise<void> {
if (forceError) {
throw new Error('Forced error in checkAuth');
return Promise.resolve();
function fetchWithAuth(id: string): Promise<string> {
return Promise.resolve(`fetched: ${id} with auth`);
engineersamuel / react-router-4.0.0-alpha.5.d.ts
Created Feb 9, 2017 — forked from wesm87/react-router-4.0.0-alpha.5.d.ts
TypeScript definitions for React Router v4 Alpha
View react-router-4.0.0-alpha.5.d.ts
* Custom typedef for React Router v4 (WIP).
declare module 'react-router' {
export type Action = 'PUSH' | 'REPLACE' | 'POP';
export type Location = {
pathname: string,
search: string,
You can’t perform that action at this time.