Skip to content

Instantly share code, notes, and snippets.

View mbensch's full-sized avatar

Marcel Bensch mbensch

View GitHub Profile
#!/bin/sh
# git prepare-commit-msg hook for automatically prepending an issue key
# from the start of the current branch name to commit messages.
# check if commit is merge commit or a commit ammend
if [ $2 = "merge" ] || [ $2 = "commit" ]; then
exit
fi
ISSUE_KEY=`git branch | grep -o "\* \(.*/\)*[A-Z]\{2,\}-[0-9]\+" | grep -o "[A-Z]\{2,\}-[0-9]\+"`
// @refactor
import { useState, useRef, useEffect } from 'react';
import { addEventListener } from 'consolidated-events';
import KeyCode from 'lib/constants/KeyCode';
const useKeyboardNavigation = (maxFocus = null, vimMode = false) => {
const ref = useRef(null);
const [focusedIndex, setFocusedIndex] = useState(0);
import React from 'react';
import { useAddonState } from '@storybook/api';
import { ADDON_ID, INITIAL_STATE, MOSSIO_THEME } from './shared';
import { ThemeProvider } from 'emotion-theming';
const Branding = ({ story }) => {
const [{ brandPrimary, brandSecondary }] = useAddonState(ADDON_ID, INITIAL_STATE);
const branding = ancestorTheme => ({
...ancestorTheme,
import React from 'react';
import { useAddonState } from '@storybook/api';
import { ADDON_ID, INITIAL_STATE, MOSSIO_THEME } from './shared';
import { ThemeProvider } from 'emotion-theming';
const withBranding = storyFn => {
const [{ brandPrimary, brandSecondary }] = useAddonState(ADDON_ID, INITIAL_STATE);
const branding = ancestorTheme => ({
...ancestorTheme,
{code}
var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
function fizzbuzz(number) {
if( number%15 == 0 ) return "fizzbuzz";
if( number%3 == 0 ) return "fizz";
if( number%5 == 0 ) return "buzz";
return number;
}
for (let i = 0; i <= 100; i++) {
return fizzbuzz(i);
}
import { Module } from 'reductor';
import {
InitSessionAction,
InitSessionReducer,
InitSessionPayloadCreator,
} from './actions/InitSession';
import {
UserLoginAction,
// Framework Imports
import 'babel-polyfill';
import { Application } from 'reductor';
import React from 'react';
import { Route, IndexRedirect } from 'react-router';
// Constants for Developmen purposes
const ENV = process.env.NODE_ENV || 'development';
const DevTools = window.devToolsExtension ? window.devToolsExtension() : f => f;
const myActionCreator = (actionType, payloadCreator) => {
return {
type: actionType,
payload: payloadCreator
};
}
const myPayloadCreator = (input) => {
return API.makeApiCall(input);
}
export default () => next => action => {
const callAPI = action[CALL_API];
if (typeof callAPI === 'undefined') {
return next(action);
}
const { url, types } = callAPI;
// const url = action.url;
// const types = action.types;
const [requestType, successType, failureType] = types;