Skip to content

Instantly share code, notes, and snippets.

View avdg's full-sized avatar

Anthony Van de Gejuchte avdg

View GitHub Profile

Various command line applications use an Interpreter Directive to define how they should be run.

#! js -m foo
#! node foo
exports.reversePath = function(path)
{
var reversedPath = [];
for(var i = 0; i < path.length; i++)
{
var currentStep = path[i];
var dx = currentStep.dx * -1;
var dy = currentStep.dy * -1;
@sscholl
sscholl / engine.js
Last active June 6, 2016 17:21 — forked from avdg/engine.js
var global = self;
var Reflect = {
global: global
};
!function a(b, c, d) {
function e(g, h) {
if (!c[g]) {
if (!b[g]) {
@laverdet
laverdet / README.md
Last active September 7, 2021 05:02
Screeps git sync script

To use first you need to create two branches, master and sim using the in-game editor. Then just run node sync.js from your local machine. When you're on your local master branch it will push to master in game, any other branch (including detached states) will push to sim. Note that it will push unstaged changes, so be careful when switching to branches with modified code.

There is support included for compressing your JS files on the server side via UglifyJS. Some users reported some speedups by compressing their code, however I did not notice any significant gains. Furthermore, UglifyJS does not yet support ES6 features, so it's disabled by default.

@media screen and (max-width: 719px) {
.nytint-upshot-stream-item-bCol {
margin: 0;
}
.nytint-upshot-stream-item .photo.embedded.layout-large-horizontal,
.nytint-upshot-stream-item-article .story-heading {
max-width: 100%;
}
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@Blackshawk
Blackshawk / blog - Explaining My Choices Further.md
Last active April 25, 2023 19:31
In which I do a little digging about the choices I've made with PHP. This is a long read, but it isn't something that can be explained in one or two paragraphs.

In the comments from my last post and on Twitter I noticed a lot of people who had something to say about PHP. The comments were varied but they usally sounded something like this (sorry @ipetepete, I picked yours because it was the shortest).

...the little bits of soul from all of us who've had to work on, and or maintain large PHP applications. – ipetepete

In Pete's defense, he did go on to say that rest of the stack I was using was a "smorgasbord of awesome". Thanks, Pete. I agree!

I would, however, like to take a little time to correct a misperception in the developer community about PHP. I recently got into this same... discussion... with Jeff Atwood, and I seem to be running into it more and more. So here goes. Please bear with me as I cover a little history further on.

Pete, and everybody else, _you're exactly rig

@lsauer
lsauer / gist:2907369
Last active January 17, 2022 09:59
Google Chrome special pages for memory, debug, resources, profiling, downloads...

####lsauer.com


###Overview of all chrome:// pages.

  • List by calling chrome://about/
  • Following is a direct dump from the 'about' page for reference

###List of Pages as per v20.xxx

@jboner
jboner / latency.txt
Last active March 29, 2024 14:26
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@pascaldevink
pascaldevink / scrollspy.js
Created April 13, 2012 20:53
ScrollSpy in pure javascript
/*
Copyright (C) 2021 Pascal de Vink (Tweakers.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of