Skip to content

Instantly share code, notes, and snippets.

Avatar

James CrazyPython

View GitHub Profile
View mandelbrot.d
import std.stdio;
import std.math;
import core.time;
import core.time;
real myFmax(real a, real b) {
if (a > b) return a;
else return b;
}
View gist:c3a522b32fd41e46a8677ba845bc9428
attaaaggtttataccttcccaggtaacaaaccaaccaactttcgatctcttgtagatctgttctctaaacgaactttaaaatctgtgtggctgtcactcggctgcatgcttagtgcactcacgcagtataattaataactaattactgtcgttgacaggacacgagtaactcgtctatcttctgcaggctgcttacggtttcgtccgtgttgcagccgatcatcagcacatctaggtttcgtccgggtgtgaccgaaaggtaagatggagagccttgtccctggtttcaacgagaaaacacacgtccaactcagtttgcctgttttacaggttcgcgacgtgctcgtacgtggctttggagactccgtggaggaggtcttatcagaggcacgtcaacatcttaaagatggcacttgtggcttagtagaagttgaaaaaggcgttttgcctcaacttgaacagccctatgtgttcatcaaacgttcggatgctcgaactgcacctcatggtcatgttatggttgagctggtagcagaactcgaaggcattcagtacggtcgtagtggtgagacacttggtgtccttgtccctcatgtgggcgaaataccagtggcttaccgcaaggttcttcttcgtaagaacggtaataaaggagctggtggccatagttacggcgccgatctaaagtcatttgacttaggcgacgagcttggcactgatccttatgaagattttcaagaaaactggaacactaaacatagcagtggtgttacccgtgaactcatgcgtgagcttaacggaggggcatacactcgctatgtcgataacaacttctgtggccctgatggctaccctcttgagtgcattaaagaccttctagcacgtgctggtaaagcttcatgcactttgtccgaacaactggactttattgacactaagaggggtgtatactgctgccgtgaacatgagcatgaaattgcttggtacacggaacgttctgaaaagagctatgaattgcagaca
View justenoughcss.md

'Just enough' theory to start using CSS.

This is intended for programmers used to imperative programming, but have always felt frustrated with CSS, unable to grok it.

CSS has two important modes, box and flex.

Every CSS element has a default size.

This default size is what it renders as if you don't add any CSS.

View gist:7fe9bdd19d05be458ec84276cf01a79e
int[3] newArr;
{
int i = 0;
foreach (int id; neighborhood) {
if (id != 0)
newArr[i++] = id;
}
}
int nextColor;
if (newArr[0] == newArr[1]) {
@CrazyPython
CrazyPython / How to build DPP on Ubuntu.md
Last active Sep 5, 2019
How to build DPP on Ubuntu for Dlang
View How to build DPP on Ubuntu.md

How to build DPP on Ubuntu

  1. install libclang-6.0-dev
  2. add dpp to your dependencies in your dub project
  3. dub run dpp
View gist:a292f752aebdf90b4c10486312f6c5f6
# Leadership
Syncinus, I think it’s best if you and the other devs hunker down and keep developing ArraX while I’m gone.
You are my deputy. You will be the king of ArraX while I’m gone.
If you choose to actively promote ArraX, you need 1) get confirmed 60fps under multiple tests 2) get a discussable gamemode in- the one I have in mind is CTHD 3) set up a system where you can buy servers dynamically based on how much demand.
It is absolutely imperative that you DO NOT promote ArraX until all 3 conditions are met. When I am back on the 5th, I can help implement all 3. It is crucial because you only have ONE chance to sell ArraX to Diep players.
## Motivation
Motivation and other’s self-confidence is a crucial element of how effective you effecticw your team is. Trust me on this one. Different things motivate different people. I nudge developers into working on Arras by giving them the self-confidence to try. I remind them that if they fail, as long as they tried, they can always talk about their failure.
View ctf.js
/** START GAMEMODE FILE **/
// gamemode files would be best in CoffeeScript
// real width is 3000
// food was originally 800, food would add an element of dodging
// this mode should have the leaderboard disabled on the client
// npm install driftless for more accurate timing
// also could npm install driftless help make arras faster, by maing gameloop execute more accurately?
gamemode = {}
gamemode.flagCarriers = []
gamemode.flagTimes = {}
View clientperformance.md

to help us gather more information on what's lagging the client, click the 3 dots on the left and find "Developer Tools": Then click "Performance:" Then click "Record." Play the game. You can minimize DevTools now. Once you've played for a while and have experienced FPS lag, open DevTools again by clicking the chrome icon on the windows taskbar and click the "download" icon:

View dngen.d
import std.stdio, std.traits, std.string, std.meta, std.algorithm, std.range;
// todo: make vim fold comments so I can write doc.d inline in the file
// support JS getters and setters for nested structs
// generate each involved struct to its own file
/++Write @DataViewName(<string literal>) before a struct to specify the
DataView a struct will be allocated on. Only applicable to
AllocationType.array +/
struct DataViewName {
View benchmark.sh
time node --trace-opt --trace-deopt -e '
function bench() {
const loops = 3000;
const objSize = 4 * 3
const i32StartOffset = loops * objSize
const i32Size = 4 * 2
const ab = new ArrayBuffer(i32StartOffset + i32Size)
const f32 = new Float32Array(ab, 0)
const i32 = new Int32Array(ab, i32StartOffset)
You can’t perform that action at this time.