Skip to content

Instantly share code, notes, and snippets.

react-spring simple example

(ns some.core)
;;editor
{:id "data-model"
:code ""
:format "cljs"
:doc "model, what are the parts?"
:show-implementation? true
:show-code? true
:show-narrative? true
(def draft-js js/Draft)
;; or any other mode of import
(def Editor (.-Editor draft-js))
(def EditorState (.-EditorState draft-js))
(def convertToRaw (.-convertToRaw draft-js))
(def convertFromRaw (.-convertFromRaw draft-js))
(defn raw-json
[state]
(let [content-state (.getCurrentContent @state)
@nrfm
nrfm / MainApp.js
Created April 17, 2018 21:06
wrapping dnd for easier interop with reagent
import App from 'dndWrapper';
const grid = 8;
const getListStyle = (boardName,isDraggingOver) => ({
background: isDraggingOver ? 'lightblue' : 'lightgrey',
padding: grid,
width: 400
});
(ns datascript-diff
(:require [datascript.core :as d]
[datascript.btset :as btset]))
(defn- keys-eq? [a b]
(or (identical? (.-keys a) (.-keys b))
(let [achunk (btset/iter-chunk a)
bchunk (btset/iter-chunk b)]
(and (== (count achunk) (count bchunk))
@nrfm
nrfm / es6-class-react.cljs
Created October 20, 2017 13:07 — forked from dvingo/es6-class-react.cljs
React component in pure cljs using ES6 class inheritance
;; implementing a React component in pure cljs, no reagent necessary
;; using goog.object.extend to create a ES6 class that inherits from
;; React.Component
;; credit to @thheller
(defn MyReact [props context updater]
(this-as this
(js/React.Component.call this props context updater)))
import React, {Component} from "react";
import {AgGridReact} from "ag-grid-react";
var totalRow = {name: "Total", price1: 6000, price2: 139000};
function getRowHeight(params){
// assuming 50// 15 characters per line, working how how many lines we need
return 18 * (Math.floor(params.data.name.length / 15) + 1);
//return 100;
}
using UnityEngine;
using System.Collections;
public class MaterialColorChanger : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.R))
{
GetComponent<Renderer> ().material.color = Color.red;
using UnityEngine;
using System.Collections;
public class CameraLookAt : MonoBehaviour
{
public Transform target;
void Update ()
{
transform.LookAt(target);
using UnityEngine;
using System.Collections;
public class Rotator : MonoBehaviour {
// Before rendering each frame..
void Update ()
{
// Rotate the game object that this script is attached to by 15 in the X axis,
// 30 in the Y axis and 45 in the Z axis, multiplied by deltaTime in order to make it per second