Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<script>
var Module = {
wasmBinaryFile: "site.wasm",
onRuntimeInitialized: main,
};
function run_with_ptr(vec_ptr, cb) {
const ptr = Module.HEAPU32[vec_ptr / 4];
@thomas-jeepe
thomas-jeepe / RaisedButton.js
Created November 4, 2015 02:58
Material design button with react-motion
import React, { Component } from 'react';
import ReactDom from 'react-dom'
import { TransitionMotion, spring, Motion } from 'react-motion';
class RaisedButton extends Component {
constructor() {
super()
this.state = {mouse: [], now: 't' + 0, height: 0, width: 0}
}
@thomas-jeepe
thomas-jeepe / ffi.rs
Created October 20, 2017 18:48
JsBytes
use std::mem;
/// Struct that can be used to store a vector of bytes and sent
/// to JS
#[repr(C)]
#[derive(Debug)]
pub struct JsBytes {
ptr: u32,
len: u32,
}
module Verify = {
type state = {
verifying: bool,
token: string
};
type action =
| SendVerification string
| DidVerify;
let component = ReasonReact.reducerComponent "Verify";
let make ::history ::email ::token _children => {
------------------------------ MODULE PingPong ------------------------------
EXTENDS Integers
(***************************************************************************)
(* A simple ping pong game designed for learning *)
(***************************************************************************)
VARIABLES p1, \* Points of player 1
p2, \* Points of player 2
pc \* What the current state of the game is
extern crate libc;
use std::ffi::{CString, CStr};
use std::mem;
trait Interop {
fn as_int(self, _: &mut Vec<CString>) -> libc::c_int;
}
impl Interop for i32 {
@thomas-jeepe
thomas-jeepe / Console
Created August 20, 2017 02:58
The console output
/Users/PenguinSoccer/.cargo/bin/cargo test --color=always --package cpro -- --nocapture
Compiling clippy_lints v0.0.151
error[E0308]: mismatched types
--> /Users/PenguinSoccer/.cargo/registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.151/src/consts.rs:288:48
|
288 | let def = self.tables.qpath_def(qpath, id);
| ^^ expected struct `rustc::hir::HirId`, found struct `syntax::ast::NodeId`
|
= note: expected type `rustc::hir::HirId`
found type `syntax::ast::NodeId`
@thomas-jeepe
thomas-jeepe / RandomFuncs.js
Last active December 12, 2015 18:08
some useful funcs
let pipe = (...funcs) => (...args) => funcs.reduce((vals, func) => (
vals === args ? func(...vals) : func(vals)
), args)
let curry = (func) => function newCurry (...args) {
return args.length < func.length ? newCurry.bind(null, ...args) : func.bind(null, ...args)()
}()
let map = curry((func, arr) => {
let l = arr.length
import React, { PropTypes, Component } from 'react';
import { TransitionMotion, spring, presets } from 'react-motion';
let paths = ['/scooby', '/dooby', '/doo']
let lastPath
export default class RouteTransition extends Component {
static propTypes = {
pathname: PropTypes.string.isRequired
import React, { Component } from 'react';
import {TransitionMotion, spring, utils} from 'react-motion';
export default class Demo extends Component {
constructor() {
super()
this.state = {mouse: [], now: 't' + 0}
}
handleMouseMove({pageX, pageY}) {