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 Head from 'next/head'; | |
import { ApolloProvider } from '@apollo/react-hooks'; | |
import { ApolloClient } from 'apollo-client'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
import { HttpLink } from 'apollo-link-http'; | |
import fetch from 'isomorphic-unfetch'; | |
let browserClient = null; |
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
set -e | |
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2) | |
if [[ "$CURRENT_BRANCH" == "develop" ]] | |
then | |
git pull | |
REL=$(npm --no-git-tag-version version minor | sed 's/^v//') | |
git checkout -b release/$REL | |
git add package.json package-lock.json |
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, { useContext } from 'react'; | |
declare global { | |
interface Window { | |
__DI_CONTAINER__: Container; | |
} | |
} | |
type Newable<T> = new (...args: unknown[]) => T; |
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
// define the module of the bootstrap app | |
var bootstrapModule = angular.module('bootstrapModule', []); | |
// the bootstrap service loads the config and bootstraps the specified app | |
bootstrapModule.factory('bootstrapper', function ($q, $http) { | |
return { | |
bootstrap: function (appName) { | |
var deferred = $q.defer(); | |
// do initial loading here |
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 {Pipe, PipeTransform} from '@angular/core'; | |
@Pipe({ | |
name: 'filterBy' | |
}) | |
export class FilterByFilter implements PipeTransform { | |
transform(list, arg: string) { | |
if (!list) { | |
return []; | |
} |
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
// BEFORE YOU start | |
// npm init -y | |
// npm install --save node-fetch rx | |
const Rx = require('rx'); | |
const fetch = require('node-fetch'); | |
// 1. create a stream based on an array using Rx.Observable.fromArray | |
const list = [1, 2, 3, 4, 5]; // list is a regular Array | |
const streamA = Rx.Observable.fromArray(list); // stream is an Observable, it will emit all values immediately |
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
app.Use(async (context, next) => | |
{ | |
await next.Invoke(); | |
}); |
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
// BEFORE YOU start | |
// npm init -y | |
// npm install --save node-fetch | |
const fetch = require('node-fetch'); | |
// INTRO | |
// Javascript is single threaded, meaning that two bits of script cannot run at the same time. | |
// Doing something which takes some time (a costly algorithm, a back-end call) causes everything else to halt | |
// until it completes. In browsers, this often means the UI becomes non-responsive, | |
// because the rendering of the screen is blocked. |
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
<?php | |
/* | |
Plugin Name: Tools Loader | |
Description: A plugin to load project-specific AngularJS snippets (mini apps) using shortcodes. | |
Version: 0.1 alpha | |
Author: Jeroen Berndsen | |
Author URI: http://www.jberndsen.nl | |
*/ | |
// load requirejs |
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 {Injectable} from '@angular/core'; | |
import {window} from '@angular/platform-browser/src/facade/browser'; | |
@Injectable() | |
export class StorageService { | |
// todo: make these configurable, have a look at | |
// https://github.com/phenomnomnominal/angular-2-local-storage/ | |
private prefix = 'my_ng2_app'; | |
private storageType: 'sessionStorage' | 'localStorage' = 'sessionStorage'; | |
private storage: any; |
NewerOlder