Skip to content

Instantly share code, notes, and snippets.

var newGame = true;
var snakeX, snakeY;
var snakeSize = 15;
var direction = -1;
var endGame = false;
var stepSize = 7;
<strong>yo</strong>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@pstoica
pstoica / StreamProvider.jsx
Last active August 29, 2015 14:24
react-rx-component + hot reloading
import React from 'react';
import { createRxComponent } from 'react-rx-component';
import { increment$ } from './intents';
export default class StreamProvider extends React.Component {
render() {
let { props$, streams, children, ...rest } = this.props;
return React.createElement(
createRxComponent(props$ ? props$(streams) : ($props) => $props, children),
@pstoica
pstoica / OnBlurComponent.jsx
Last active August 1, 2023 21:00
onBlur for entire react element
function OnBlurComponent({ onBlur }) {
const handleBlur = (e) => {
const currentTarget = e.currentTarget;
// Check the newly focused element in the next tick of the event loop
setTimeout(() => {
// Check if the new activeElement is a child of the original container
if (!currentTarget.contains(document.activeElement)) {
// You can invoke a callback or add custom logic here
onBlur();
import arb.soundcipher.*;
SoundCipher midi = new SoundCipher(this);
int beat;
//float[] pitches = {60, 64, 66, 67, 62, 71, 69, 61, 65, 63, 68, 70};
void setup() {
//frameRate(2);
beat = 0;
import arb.soundcipher.*;
SoundCipher midi = new SoundCipher(this);
int beat;
void setup() {
frameRate(8);
beat = 0;
}
int cell = 35; // Individual cell size
int cols, rows; // Total number of columns and rows
float valueR = 50.0;
float valueG = 50.0;
float valueB = 50.0;
int count = 0;
int squareCount = 0;
sqProp[][] square;