Skip to content

Instantly share code, notes, and snippets.

David Pohan pohy

Block or report user

Report or block pohy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View basic-raymarching.glsl
#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);
}
@pohy
pohy / init.js
Created Jun 4, 2019
Async mJS RPC Handler
View init.js
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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Race</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
View race.html
<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');
@pohy
pohy / TaskPresenter.php
Created Nov 21, 2013
Nette example application
View TaskPresenter.php
<?php
use Nette\Application\UI\Form;
class TaskPresenter extends BasePresenter
{
private $listRepository;
private $userRepository;
private $taskRepository;
private $list;
You can’t perform that action at this time.