Skip to content

Instantly share code, notes, and snippets.

View swallentin's full-sized avatar

Stephan Wallentin swallentin

View GitHub Profile
const { google } = require("calendar-link");
const dates = {
"2023-01-02": ["12:30", "13:15", "14:00", "14:45", "15:30"],
"2023-01-03": ["09:30", "10:00"],
"2023-01-04": ["09:30", "10:15", "11:00"],
"2023-01-05": [
"09:30",
"10:15",
"11:00",
module.exports = function override(config, env) {
// NOTE: The current version of react-scripts-ts does not support yarn/lerna workspaces.
// As we're using TypeScript source code from a different module the TypeScript compilation can't locate source files outside of the current module,
// due to the fact that webpack is responsible for compiling TypeScript. The webpack config is "protected" as it's a part of the react-scripts-ts package.
// In short this hack find the ts-loader from the webpack config and removes the "include" property from the webpack ts-loader config.
// We do this hack to avoid having to eject the project from create-react-app or having to fork the react-script-ts repository and remove one line of code.
config.module.rules = config.module.rules.map(rule => {
var isOneOf = Object.keys(rule).findIndex(key => key === "oneOf") === 0;
if (isOneOf) {
window.nn['autosave'];
const APP = ({children}) => (
<AutoSaveContextProvider>
<div>{children}</div>
</AutoSaveContextProvider>
);
const SignupAssessmentComponent = () => (<h1>SignupAssessmentComponent</h1>);
const SignupPortfolioComponent = () => (<h1>SignupPortfolioComponent</h1>);
@swallentin
swallentin / ResponsiveChartContainer.jsx
Created August 20, 2016 07:50
D3 Responsive Chart Container
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import d3 from 'd3';
class ResponsiveChartContainer extends Component {
static defaultProps = {
width: '100%',
height: 300,
margin: {top: 0, right: 0, bottom: 0, left: 0}
(function () {
'use strict';
angular
.module('eva2-angular')
.directive('evaInvalidCredentialsValidator', function ($rootScope) {
return {
require: 'ngModel',
link: function (scope, el, attr, ctrl) {
var onInvalidCredentials = function (event, message) {
@swallentin
swallentin / DirectiveImplementationStyleA.js
Created February 25, 2016 13:02
Angular Directive Implementation Comparision
angular.module('eva2-angular').directive('myDirective', function ($state) {
'use strict';
return {
restrict: 'A',
link: function (scope, el) {
if($state.current.name !== '') {
angular.element(el).addClass($state.current.name);
}
}
cramo.service('Cart', function($http, $q, $localStorage) {
var _cart = null,
_items = null,
self = this,
getCart = function(userID) {
var deferred = $q.defer();
if(_cart) {
deferred.resolve(_cart);
@swallentin
swallentin / Service.js
Created November 18, 2015 10:37
Alternative
angular.module('topdog')
.factory('Profile', function ($http, settings, $log) {
$log.log(settings);
var meApiUrl = [settings.endPoints.base, settings.endPoints.me.path].join(''),
playerbySteamIdUrl = [settings.endPoints.base, settings.endPoints.player.base].join('');
return {
me: function () {
return $http.get(meApiUrl, { withCredentials: true})
},
getPlayerBySteamId: function (steamId) {
@swallentin
swallentin / AuthenticationServices.js
Last active November 18, 2015 10:35
How to use Promises for the win
angular.module('myapp.security')
.factory('authentication', function ($http, $q, settings, authService) {
this._userContext = null;
var _this = this,
_fetchContext = function () {
var deferred = $q.defer();
$http({
method: 'GET',
url: settings.authentication.resourceEndPoints.context
})
@swallentin
swallentin / PlayerMatchStats.js
Created November 10, 2015 17:39
Quake Live Sample Mongoose Schema
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
function makeGunSchemaProperty (object, type, key) {
['p', 'k', 'd', 's', 'h', 't', 'dg', 'dr'].forEach(function (keyPrefix) {
object[key + keyPrefix] = type;
});
}
var schemaBase = {
guid: String,