Skip to content

Instantly share code, notes, and snippets.

@drcmda
drcmda / index.js
Last active June 10, 2018 18:50
react without build-tools
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
@drcmda
drcmda / index.jsx
Last active November 15, 2022 20:05
react-spring with react-native
import React from 'react'
import { StyleSheet, Text, View, TouchableWithoutFeedback } from 'react-native'
import { Spring, animated } from 'react-spring/dist/native'
const styles = {
flex: 1,
margin: 0,
borderRadius: 35,
backgroundColor: 'red',
alignItems: 'center',
import React from "react"
import styled from "styled-components"
import { animated } from 'react-spring'
const AnimatedButton = ({ toggleModal, hostRef, deal, pictureRef, style, src }) => (
<AnimateButtonStyling
innerRef={hostRef}
pictureRef={pictureRef}
style={style}
onClick={() => toggleModal()}>
@drcmda
drcmda / index.html
Last active February 7, 2018 12:36
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
@drcmda
drcmda / package.json
Last active September 12, 2022 06:23
webpack 4
"scripts": {
"dev": "node .dev/webpack.dev.server.js",
"dev-prod": "node .dev/webpack.dev.server.js --production",
"build": "rimraf ./dist && webpack --config .dev/webpack.config.production.js --colors",
},
"devDependencies": {
"@babel/core": "7.0.0-beta.38",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.38",
"@babel/plugin-proposal-decorators": "7.0.0-beta.38",
"@babel/plugin-transform-classes": "7.0.0-beta.38",
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
globals.color {
objectHoverColor: ...
materialHoverColor: ...
}
Mesh.material = [{ ... }, {}, {}] || { ... }
const array = [...Mesh.material]
array.forEach( ... )
@drcmda
drcmda / .js
Created March 24, 2017 12:27
vue connect
import cloneDeep from 'lodash/cloneDeep';
import Session from 'awv3/session';
// Create & export session
export const session = window.session = new Session({ material: 'multi' });
// Export store
export const store = session.store;
// Mixin factory. Maps Redux props to Vue components
export const connect = (selector, props) => {
@drcmda
drcmda / .js
Last active January 26, 2017 11:33
material, outlining extensible structures for appearance
// ALL material info (including opacity & color) is defined under a generialized "material"
// ALL properties are optional
// color & opacity will be removed from the protocol
material: {
type: BASIC | PHONG | LAMBERT | PHYSICAL | DASHED (lines only)
opacity: 0-1,
color: [0-255, 0-255, 0-255],
fog: true | false, // affected by fog
lights: true | false, // affected by lights
@drcmda
drcmda / *.js
Last active November 15, 2017 09:41
Redux thunk example
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import _ from 'lodash';
// these types describe what i can do
const types = {
fetch: "ACTION_ADD",
remove: "ACTION_REMOVE"
}