Skip to content

Instantly share code, notes, and snippets.

View svdoever's full-sized avatar

Serge van den Oever svdoever

View GitHub Profile
@svdoever
svdoever / usebundles.js
Created August 7, 2018 22:23
Example of how to use the loadBundles function as defined in https://gist.github.com/svdoever/aebdbc6acf0bd15e354c18af9ed1bd47
process.env.ComponentServerBundles = JSON.stringify({
default: './server-bundle',
pwa: './server-bundle',
pwaremote: 'http://myserver.com/server-bundle.js'
});
// Handy for debugging to use a direct require so Visual Studio code can set breakpoints in the code
// of the bundle we are debugging.
let bundle_to_debug = require('./server-bundle');
if (process.env.NODE_ENV === 'production') {
@svdoever
svdoever / loadbundles.js
Last active August 7, 2018 21:52
NodeJS: load multiple bundles from local and remote (http, https)
// bundleConfiguration is a javascript object in the following format:
// let bundleConfiguration = {
// default: './server-bundle',
// pwa: './server-bundle',
// pwaremote: 'http://myserver.com/server-bundle.js'
// };
// bundles is an empty onbject, i.e. let bundles = {};
// the function returns an array of promises to wait for:
// bundleLoaderPromises = loadBundles(bundlesConfiguration, bundles);
// Promise.all(bundleLoaderPromises).then(() => {
@svdoever
svdoever / amp-list-video-story.json
Created June 4, 2018 10:37
Sample json file with an mp4 video over https for amp-list testing
{
"url":"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WhatCarCanYouGetForAGrand.mp4"
}
@svdoever
svdoever / youtube2mp4.js
Last active March 17, 2021 02:32
NodeJS Express service to convert YouTube url to mp4 url
const axios = require('axios');
const express = require('express');
// from https://codewithmark.com/learn-to-create-youtube-video-downloader
function qsToJson(qs) {
var res = {};
var pars = qs.split('&');
var kv, k, v;
for (i in pars) {
kv = pars[i].split('=');
@svdoever
svdoever / youtube2mp4.js
Created June 1, 2018 21:36
NodeJS Express service to convert YouTube url to mp4 url
const axios = require('axios');
const express = require('express');
// from https://codewithmark.com/learn-to-create-youtube-video-downloader
function qsToJson(qs) {
var res = {};
var pars = qs.split('&');
var kv, k, v;
for (i in pars) {
kv = pars[i].split('=');
@svdoever
svdoever / hypernova-react-async-redux.tsx
Created April 16, 2018 21:27
Utility functions for creating an async hypernova component
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMServer from 'react-dom/server';
import { Provider } from 'react-redux';
import hypernova, { serialize, load } from 'hypernova';
import { Store } from 'redux';
export const renderReactAsyncReduxServer = (name: string, C: React.ComponentClass, store: Store<any>) => hypernova({
server() {
return (props: any) => {
@svdoever
svdoever / index.js
Created April 16, 2018 21:20
Hypernova server implementation suporting async rendering
// hypernova server implementation with support for async react components
// Serge van den Oever, Macaw
//
// If the hypernova server is run from iisnode we can access the appsettings in the web.config as
// environment variable, i.e.
// <configuration><appSettings><add key="GLOBAL_PREFIX" value="somevalue"></appSettings>...
// then use var globalPrefix = process.env.GLOBAL_PREFIX; to access the setting
// Example post body:
// {
@svdoever
svdoever / MassTransitRequestResponse.cs
Created August 29, 2016 15:44
Working example of MassTransit 3 request/response conversation
using System;
using System.Threading;
using System.Threading.Tasks;
using MassTransit;
using Xunit;
namespace MassTransitRequestResponse.Test
{
public interface INamedReq
{
@svdoever
svdoever / git-branches.ps1
Last active June 9, 2016 15:18
Show the git branch status of all subfolders in a given path
param($path = (Get-Item -Path ".\" -Verbose).FullName)
Write-Host "Processing for git branch status of subfolders in folder: $path"
$items = @()
Get-ChildItem -Path $path | ?{$_.PSIsContainer } | Foreach-Object -Process {
if (Test-Path -Path (Join-Path -Path $_.FullName -ChildPath '.git')) {
pushd $_.FullName
Write-Host "Processing $($_)...."
git fetch
@svdoever
svdoever / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-quiz-view.html">
<link rel="import" href="../topeka-elements/avatars.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">