EDIT November 2017: recently the target wasm32-unknown-unknown
was added to rustc
which uses the LLVM WASM backend and works without Emscripten. This is now the recommended way of generating WASM code from Rust (as it is much easier). Thus, this gist document is pretty much useless now. A great resource on getting started with WASM and Rust is hellorust.com: Setup and Minimal Example.
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
/** | |
* --- Template Meta Program to solve the Partial Knapsack Problem --- | |
* | |
* This little piece of code solves the partial knapsack problem at compile | |
* time. This is not useful in any way. I just wanted to discover the | |
* possibilities of template meta programming. | |
* Note that this code is absolutly awful. First of all: It's a "pure" template | |
* meta program, which is ugly on it's own. Furthermore my code is ugly in | |
* particular. The motivation to clean up super-ugly code to get a little bit | |
* less ugly code is... not that high. |
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 AlgoTools.IO; | |
import java.util.Scanner; | |
import java.io.*; | |
public class PrimeTest { | |
private static String m_program; | |
private static String m_yesString; | |
private static String m_noString; | |
public static void main(String[] args) throws Exception { |
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
/****************************** FormatExample.java **************************/ | |
import AlgoTools.IO; | |
/** | |
* @author Lukas Kalbertodt <[email protected]> | |
* @author Susi Sorglos <[email protected]> | |
*/ | |
public class FormatExample { |
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
[package] | |
name = "era" | |
version = "0.1.0" | |
authors = ["Lukas Kalbertodt <[email protected]>"] | |
[dependencies] | |
time = "0.1" | |
bit-vec = "*" |
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
/****************************** FormatExample.java **************************/ | |
import AlgoTools.IO; | |
/** | |
* @author Willi Wacker <[email protected]> | |
* @author Susi Sorglos <[email protected]> | |
* | |
* Ein sinnloses, aber schön formatiertes Beispiel | |
* |
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
/** | |
* Template based Event-System by Lukas Kalbertodt <[email protected]> | |
*/ | |
#pragma once | |
// needed std headers | |
#include <map> | |
#include <memory> | |
#include <cstring> | |
#include <set> |
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
#!/bin/bash | |
TMP_PATH=/tmp/rust-blast-off-$(date +%s) | |
mkdir $TMP_PATH | |
### install rustup in tmp dir ### | |
echo "=========================================" | |
echo "=== Just press Enter soon ;-) ===" | |
echo "=========================================" |
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 class Chars { | |
public static void main(String[] args) { | |
int k = 0; | |
for (int i = 0x20; i < 0x10FFFF; i++) { | |
if (Character.isJavaIdentifierPart(i)) { | |
System.out.print(new String(Character.toChars(i))); | |
k++; | |
if (k == 32) { | |
System.out.println(); | |
k = 0; |
I cannot believe how Lieferando still has no filter for this. So here is my hacky "filter". It sets the background color of non veggie meals to red (or unsets it if it's already red). I just test for a list of German words. You probably want to adjust that.
Be aware, this is a shitty filter. Probably has lots of false positives and false negatives.
The best way to apply this is to create a new bookmark in your browser and copy the code into the target/URL field. This makes it a bookmarklet.
Licensed under CC-0.