View server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import WebSocket from 'ws'; | |
const webSocketServer = new WebSocket.Server({ server }); | |
webSocketServer.on('error', (err) => logger.error(err)); | |
webSocketServer.on('headers', (headers) => logger.log('headersi', headers)); | |
webSocketServer.on('connection', (ws) => { | |
logger.log('new connection'); | |
ws.on('open', () => logger.log('open')); | |
ws.on('close', () => logger.log('closed')); | |
ws.on('message', (message) => { |
View Player.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player : KinematicBody | |
{ | |
[Subnode] private Spatial MyNode; // finds subnode called "MyNode" which is a Spatial, crash if not found | |
[Subnode("custom_name")] private Label MyLabel; // finds a Label called "custom_name" | |
public override void _Ready() | |
{ | |
this.FindSubnodes(); // Must write `this.` because it's an extension class | |
} | |
} |
View basic-raymarching.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX_STEPS 100 | |
#define MAX_DISTANCE 100. | |
#define MIN_DISTANCE .01 | |
float getDistance(vec3 point) { | |
vec4 sphere = vec4(0, 1, 6, 1); | |
float sphereDistance = length(point - sphere.xyz) - sphere.w; | |
float planeDistance = point.y; | |
return min(sphereDistance, planeDistance); | |
} |
View init.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load('rpc.js'); | |
let testWiFi = ffi('bool mgos_captive_portal_wifi_setup_test(char*,char*,void(*)(bool,char*,char*,userdata),userdata)'); | |
RPC.addHandlerAsync('ConnectToWifi', function(respond, args) { | |
if ( | |
typeof args !== 'object' | |
|| typeof args.ssid !== 'string' || args.ssid.length < 1 | |
|| typeof args.pass !== 'string' || args.pass.length < 1 | |
) { |
View errors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ValidationResponse createValidationResponse(BindingResult result, boolean translate) { | |
ValidationResponse response = new ValidationResponse(); | |
if(!result.hasErrors()) { | |
response.setSuccess(true); | |
return response; | |
} | |
response.setSuccess(false); | |
Locale locale = LocaleContextHolder.getLocale(); | |
for (FieldError error : result.getFieldErrors()) { | |
String message = translate ? messageSource.getMessage(error, locale) : error.getCode(); |
View race.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Race</title> | |
<style type="text/css"> | |
* { | |
margin: 0; | |
padding: 0; | |
} |
View race.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="images"> | |
<img id="image_lisa" width="32" height="32" src="lisa.png"> | |
<img id="image_meggie" width="32" height="32" src="meggie.png"> | |
</div> | |
<canvas id="canvas" width="854" height="480"></canvas> | |
<script type="text/javascript"> | |
var Game = function() { | |
var canvas = document.getElementById('canvas'); | |
this.ctx = canvas.getContext('2d'); |
View TaskPresenter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Nette\Application\UI\Form; | |
class TaskPresenter extends BasePresenter | |
{ | |
private $listRepository; | |
private $userRepository; | |
private $taskRepository; | |
private $list; |