Skip to content

Instantly share code, notes, and snippets.

@nrfm
nrfm / min-char-rnn.py
Created February 23, 2017 09:47 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
using UnityEngine;
using System.Collections;
public class TransformFunctions : MonoBehaviour
{
public float moveSpeed = 10f;
public float turnSpeed = 50f;
void Update ()
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
using UnityEngine;
using System.Collections;
public class CameraLookAt : MonoBehaviour
{
public Transform target;
void Update ()
{
transform.LookAt(target);
using UnityEngine;
using System.Collections;
public class MaterialColorChanger : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown(KeyCode.R))
{
GetComponent<Renderer> ().material.color = Color.red;
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;
}
@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)))
(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 / 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
});
(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)