Skip to content

Instantly share code, notes, and snippets.

View dru's full-sized avatar

Andrii Melnyk dru

  • Unteleported.com
  • Kyiv, Ukraine
View GitHub Profile
@dru
dru / wgsl_3d_sdf.md
Created August 1, 2022 10:17 — forked from munrocket/wgsl_3d_sdf.md
3D SDF Primitives in WGSL

3D SDF Primitives in WGSL

How to use this gist:

  1. Build a sphere tracer with WebGPU (paper, paper2, youtube)
  2. Create model with sdf functions from here
  3. Add light and shadows
  4. ???
  5. PROFIT

This code tested in Chrome and Firefox, should work on PC too.

@dru
dru / Cargo.toml
Created December 26, 2018 13:00
Minimal upload server on Rust 2018
[package]
name = "server"
version = "0.1.0"
edition = "2018"
[dependencies]
rocket = "^0.4.0"
@dru
dru / upload_progress.dart
Created December 26, 2018 12:53
Upload progress with Dart and Streams
import "dart:io";
import "dart:async";
main() async {
HttpClientRequest request =
await HttpClient().post('some.host', 8000, '/upload');
request.headers.contentType = ContentType.binary;
final file = File('/some/big/file');
@dru
dru / flutter-canvas-animation-example.dart
Created July 4, 2018 13:53
Flutter Canvas animation example with CustomPainter
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/semantics.dart';
import 'dart:ui';
void main() => runApp(new MyApp());
class Sky extends CustomPainter {
final double value;
// 1. Declare outside class definition (or in its own file).
// 2. UIKit must be included in file where this code is added.
// 3. Extends UIDevice class, thus is available anywhere in app.
//
// Usage example:
//
// if UIDevice().type == .simulator {
// print("You're running on the simulator... boring!")
// } else {
// print("Wow! Running on a \(UIDevice().type.rawValue)")
@dru
dru / gist:3818329
Created October 2, 2012 11:30
Install ruby 1.8.7 on Mac OS X Mountain Lion using RVM
Install ruby 1.8.7 on Mac OS X 10.8 (Mountain Lion) using RVM and MacPorts
1) Install http://xquartz.macosforge.org
2) sudo port install apple-gcc42
3) CC=/opt/local/bin/gcc-apple-4.2 CPPFLAGS=-I/opt/X11/include rvm install 1.8.7
@dru
dru / test.html
Created July 26, 2012 16:30
Meteor quick start
<head>
<title>colors</title>
</head>
<body>
Colors:
{{> color_list}}
<hr/>
Atms:
{{> atms}}
@dru
dru / gist:2654066
Created May 10, 2012 15:51
PhantomJS render page
var page = new WebPage(), url = 'http://refine.io';
page.open(url, function (status) {
if (status === 'success') {
page.render("refineio.png");
phantom.exit();
}
});
@dru
dru / gist:2642796
Created May 9, 2012 07:54
Rotate board puzzle
require 'rubygems' # sudo gem install gosu --no-ri --no-rdoc
require 'gosu'
class Board < Array
def rotate cw = false
rotated = if cw
transpose.map(&:reverse)
else
transpose.reverse
@dru
dru / Rakefile
Created April 12, 2012 17:53 — forked from jeffreyiacono/Rakefile
rake task for precompiling assets using sprockets within a sinatra app + view helpers
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end