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
using GR, Random, Memoize | |
const xmin = 0 | |
const ymin = 0 | |
const xmax = 1 | |
const ymax = 1 | |
const resx = 512 | |
const resy = 512 | |
const hx = resx>>1 | |
const hy = resy>>1 |
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
using GR, Random | |
rule30(p,q,r) = (p) ⊻ (q | r) | |
rule90(p,q,r) = p ⊻ r | |
rule110(p,q,r) = (p | q) ⊻ (p & q & r) | |
rule = rule110 | |
xmin = ymin = 0 | |
xmax = 1 |
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
using GR, Random, Memoize | |
xmin = ymin = -3 | |
xmax = ymax = 3 | |
resx = resy = 400 | |
setviewport(0, 1, 0, 1) | |
setwindow(xmin, xmax, ymin, ymax) | |
setcolormap(3) |
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 HashBag<T> { | |
HashMap<T, AtomicInteger> map = new HashMap<>(); | |
public void increment(T key) { | |
AtomicInteger value = map.get(key); | |
if (value == null) { | |
map.put(key, new AtomicInteger(1)); | |
return; | |
} |
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
private static class Capture implements AutoCloseable { | |
private final PrintStream oldStdOut; | |
private final PrintStream newStdOut; | |
private StringWriter writer = new StringWriter(); | |
private Capture() { | |
oldStdOut = System.out; | |
newStdOut = new PrintStream(new WriterOutputStream(writer, StandardCharsets.UTF_8)); | |
System.setOut(newStdOut); |
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
function myFunction() { | |
var datasheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0].getDataRange().getValues();// if other columns, change index values in the arrays : 0=A, 1=B ... | |
var text = ""; | |
for(l=1;l<10;l++) { | |
text = text + "# idioma " + datasheet[0][l] + "\n"; | |
for(i=1;i<datasheet.length;++i) { | |
if(datasheet[i][0] != '') { | |
text = text + datasheet[i][0] + " = " + datasheet[i][l] + "\n"; | |
} | |
} |
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
/** | |
* Simple reflection based toString() method. Dumps object field values (except <code>serialVersionUID</code>) to a | |
* string in a JSON type format. | |
* | |
* @param object the object to get a string representation of. | |
* @return a string with the fields and values of the object. | |
*/ | |
public static <T> String toString(T object) { | |
Class<?> c = object.getClass(); | |
StringBuilder s = new StringBuilder(c.getSimpleName()).append(" { "); |