Skip to content

Instantly share code, notes, and snippets.

View macrozone's full-sized avatar

Marco Wettstein macrozone

View GitHub Profile
fizzbuzz = function(number) {
if (number % 15 === 0) {
return 'FizzBuzz';
}
if (number % 3 === 0) {
return 'Fizz';
}
if (number % 5 === 0) {
return 'Buzz';
/**
DRAFT for a i18n_service for meteor-mantra-apps, it uses https://github.com/vazco/meteor-universe-i18n/
Made to be used in configs/context.js in mantra:
const supportedLocales = [ 'de', 'en', 'fr', 'it' ];
const defaultLocale = 'de';
const i18n = I18nService(
{universeI18n, SimpleSchema, FlowRouter},
{supportedLocales, defaultLocale}
@macrozone
macrozone / FileField.jsx
Last active May 31, 2017 22:57
File-filed with uniforms and ostrio:files in meteor
import React from 'react';
import { connectField } from 'uniforms';
import Dropzone from 'react-dropzone';
import withMeteorUploader from '../../hocs/with_meteor_uploader';
import CollectionImage from '/client/modules/core/containers/collection_image';
export const ImageFile = ({
disabled,
id,
label,
@macrozone
macrozone / scene-extended.js
Created January 8, 2017 14:58
react-three extended scene
import { Scene } from 'react-three';
import THREE from 'three';
import _ from 'lodash';
/**
we extend the react-three-scene with support for more properties:
- onOrbit: will be called when orbitcontrols are changed. It will pass the current camera
- onClickRay: will be called on a click on the scene with arguments:
event, the current ray from the camera to the mousePosition and the mousePosition
- onMouseMoveRay: same as above, but on every mousemove
**/
import React from 'react';
import withTheme from '/lib/withTheme';
import { withUploader } from '@panter/manul-files';
import { useDeps, composeAll } from 'mantra-core';
import BoxedImage from '/client/modules/core/components/boxed_image';
import { connectField } from 'uniforms';
import DropZone from 'react-dropzone';
import { Styles } from './TextField';
import formCol from './FormCol';
import _ from 'lodash';
tabSize: 2
storybook: true
generateComponentTests: false
generateContainerTests: false
modulesPath: src/modules
snakeCaseFileNames: false
templates:
- name: 'storybook'
text: |
// @flow
// @flow
import { css } from 'styled-components'
export default {
colors: {
greyDark: '#515151',
greySemiDark: '#7D7D7D',
grey: '#A4A4A4',
greySemiLight: '#C6C6C6',
@macrozone
macrozone / ModelWithDownload.js
Last active March 29, 2018 15:42
Example how to download a 3dmodel from the internet using react-native-arkit
// @flow
import { ARKit } from '@panter/react-native-arkit'
import { branch, compose, lifecycle, renderComponent } from 'recompose'
import { unzip } from 'react-native-zip-archive'
import RNFetchBlob from 'react-native-fetch-blob'
import React from 'react'
const getModelPath = modelId => (
`${RNFetchBlob.fs.dirs.CacheDir}/models/${modelId}/`
@macrozone
macrozone / ARLineSegment.js
Created October 17, 2017 19:23
react-native-arkit Cylinder from a to b
import { ARKit } from 'react-native-arkit'
import React from 'react'
import type { Point3D } from '../../../types'
import { length, center, diff, distance } from '../libs/vectorUtils'
const PI_2 = Math.PI / 2