Skip to content

Instantly share code, notes, and snippets.

View Nyrox's full-sized avatar
🏃‍♀️
coding fast boii

Mark-Oliver Junge Nyrox

🏃‍♀️
coding fast boii
View GitHub Profile
@Nyrox
Nyrox / tryjsil.cs
Created August 18, 2015 04:37
My Gist
using System;
using JSIL;
using JSIL.Meta;
public static class Program {
public static int x = 10;
public static int y = 20;
public static void Main () {
dynamic document = Builtins.Global["document"];
/*
Given two strings, find the number of common characters between them.
Example
For s1 = "aabcc" and s2 = "adcaa", the output should be
commonCharacterCount(s1, s2) = 3.
Strings have 3 common characters - 2 "a"s and 1 "c".
*/
struct ParseVisitor<T> {
_marker: PhantomData<T>
}
impl<'de, T> Visitor<'de> for ParseVisitor<T>
where T: std::str::FromStr
{
type Value = T;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@Nyrox
Nyrox / nn.rs
Last active May 24, 2018 12:15
extern crate rand;
use rand::Rng;
const TRAINING_SET_SIZE: u64 = 1024;
fn transfer_derivative(output: f64) -> f64 {
return output * (1.0 - output);
}
#[derive(Clone, Debug)]
pub fn launch_tiled<C: 'static + Clone + Sync + Send + Fn(super::Tile)>(
self,
scene: Scene,
tile_size: (usize, usize),
cb: C,
) -> () {
let queue = Arc::new(MsQueue::new());
// Generate tiles
{
pub fn render_tiled(scene: Scene, settings: Settings) -> mpsc::Receiver<super::Tile> {
let queue = Arc::new(MsQueue::new());
let (sender, receiver) = mpsc::channel();
// Split the backbuffer into tiles and push them into the queue
{
let mut x = 0;
let mut y = 0;
'gen_tiles: loop {
@Nyrox
Nyrox / b.rs
Created September 27, 2018 20:36
pub fn render_tiled(scene: Scene, settings: Settings) -> TaskHandle {
let queue = Arc::new(MsQueue::new());
let (sender, receiver) = mpsc::channel();
// Split the backbuffer into tiles and push them into the queue
{
let mut x = 0;
let mut y = 0;
'gen_tiles: loop {
/* tslint:disable */
var wasm;
const TextDecoder = require('util').TextDecoder;
let cachedDecoder = new TextDecoder('utf-8');
let cachegetUint8Memory = null;
function getUint8Memory() {
if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) {
cachegetUint8Memory = new Uint8Array(wasm.memory.buffer);
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const main = {
entry: ['./source/main.js', './assets/styles/main.scss'],
output: {
filename: "main.js",
path: path.resolve(__dirname, "dist")
},
resolve: {
Constant buffer:
[6, 20, 20, 12, 0, 2, 0]
Variable Slots:
{}
Instruction block:
main