Skip to content

Instantly share code, notes, and snippets.

View zouhir's full-sized avatar
🪀
Yoyo

Zouhir ⚡️ zouhir

🪀
Yoyo
View GitHub Profile
void polygon(int sideCount, float radius) {
float theta = 0.0;
float x = 0.0;
float y = 0.0;
float R = random(255);
float G = random (255);
float B = random (255);
beginShape();
import de.voidplus.leapmotion.Bone;
import de.voidplus.leapmotion.Arm;
import de.voidplus.leapmotion.*;
LeapMotion leap;
void setup(){
size(displayWidth, displayHeight, P3D);
background(255);
#### Step1:
In app entry, comment `registerServiceWorker()`
#### Step2:
Your service worker file is supposed to be in: `https://yourdomain.com/service-worker.js` and this file is never
chacehd at yoyr users computer for offline use.
so after commenting the `registerServiceWorker` in your CRA app entry, the
#### Step1:
In app entry, comment `registerServiceWorker()`
#### Step2:
Your service worker file is supposed to be in: `https://yourdomain.com/service-worker.js` and this file is never
chacehd at yoyr users computer for offline use.
so after commenting the `registerServiceWorker` in your CRA app entry, the
@zouhir
zouhir / index.js
Last active October 23, 2017 04:01
// add this please
// add this please
require("preact-cli/lib/lib/webpack/polyfills");
// look above
import { h } from "preact";
import habitat from "preact-habitat";
import Widget from "./components/hello-world";
<!-- print it as -->
<h1><%= htmlWebpackPlugin.options.SOME_VAR %></h1>
@zouhir
zouhir / inlined-habitat.js
Last active March 26, 2018 04:30
Preact meets CMS: Building Lightweight Portable Widget Components
import { h, Component } from "preact";
import habitat from "preact-habitat";
class HelloWidget extends Component {
render() {
let time = new Date().toLocaleTimeString();
let name = this.props.name || "nobody";
return <h1>{`Hello ${name}, time is: ${time}`}</h1>;
}
}
import { h, render, Component } from "preact";
class HelloWidget extends Component {
render() {
let time = new Date().toLocaleTimeString();
let name = this.props.name || "nobody";
return <h1>{`Hello ${name}, time is: ${time}`}</h1>;
}
}
<!-- container with specific styles -->
<div class="container">
<script async src="cdn.../hello-widget.js"> </script>
</div>
helloWidgetHabitat.render({
inline: true,
clean: true,
});