Skip to content

Instantly share code, notes, and snippets.

View emilwidlund's full-sized avatar

Emil Widlund emilwidlund

View GitHub Profile
@emilwidlund
emilwidlund / App.tsx
Last active February 28, 2019 00:02
import * as React from "react";
interface Payload {
text: string;
timestamp: number;
}
interface ChatProps {
}
# Create a WebSocket connection to the chat server
ws = new WebSocket 'ws://localhost:8081'
messages = []
# Add an event listener that will trigger when connection is open
ws.onopen = (event) ->
print 'Connection to chat server is now open'
# Add an event listener that will trigger when connection closes
// Import http and ws modules
const http = require('http');
const WebSocket = require('ws');
// Create an http server
const server = new http.createServer();
// Create a WebSocket server by wrapping the http server
const wss = new WebSocket.Server({ server });
new Model
path: './models/plate.obj'
parent: scene
scale: 30
y: 100
rotationX:30
material: new THREE.MeshPhongMaterial
color: 0xffffff
specular: 0xffffff
shininess: 20
for i in [0..4]
focusable = new Focusable
parent: homeView.safezone
y: i * 90 + 100
backgroundColor: null
width: padding * 10 + padding
height: 80
x: 10
html: "#{editPlayerMenu[i]}"
style:
myPromise = new Promise (resolve, reject) ->
Utils.delay 3, () ->
print 'Function Executed after 3 seconds!'
resolve()
myPromise.then () ->
print 'This will be printed as soon as the promise executes the resolve-function'
{Scene, Light, Model} = require 'form'
# Create a scene
scene = new Scene
width: Screen.width
height: Screen.height
camera:
orbitControls: true # Enables orbit controls
enableRotate: true # Enables click & drag orbiting
{Scene, Light, Model} = require 'form'
# Create a scene
scene = new Scene
width: Screen.width
height: Screen.height
# Create a light
new Light
parent: scene
{Scene, Light, Model} = require 'form'
# Create a scene
scene = new Scene
width: Screen.width
height: Screen.height
# Create a light
new Light
parent: scene
app.on 'change:focusedElement', (focusable) ->
if focusable == focusableIWantToAnimate
focusable.animate
...