Skip to content

Instantly share code, notes, and snippets.

@grisevg
grisevg / FAsyncQueue.h
Last active October 20, 2023 03:39
Utility class for asynchronous/coroutine style programming in UE4 C++
#pragma once
/**
* FAsyncQueue can be used to run asynchronous delegates in sequence, parallel and combinations of the above
*
* Use Add() to enqueue delegates matching FAsyncDelegate signature:
* a void function that accepts a single argument of another void function with no arguments.
*
* Static factories MakeSync, MakeSequence and MakeParallel can be used to wrap different type of delegates and
* delegate collections into a single FAsyncDelegate which can be enqueued with Add().
@amatus
amatus / rust_for_rpi.md
Last active February 18, 2017 21:13 — forked from anonymous/gist:6664882
Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

sudo apt-get install git build-essential
test `uname -m` = x86_64 && sudo apt-get install ia32-libs
git clone https://github.com/raspberrypi/tools.git
export PATH=$PWD/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
git clone http://github.com/mozilla/rust.git
cd rust
./configure --target-triples=arm-unknown-linux-gnueabihf

make

@Aatch
Aatch / borrow-example.rs
Last active July 5, 2023 04:22 — forked from kolmodin/rust-json.rs
An example and explanation of how to use lifetimes and borrowing to avoid copying, while maintaining safety.
extern mod extra;
use extra::json::*;
/*
* This function manages to do absolutely no copying, which is pretty cool.
*
* "What are all those `'r`s?" you ask. Well, they're liftime parameters. They
* indicate how long something lasts (before it's freed). They can't change how
* long something lives for, they only allow you to tell the compiler stuff it
@max-mapper
max-mapper / index.js
Created July 7, 2012 00:04
geohash based spatial index on leveldb
var plumbdb = require('plumbdb')
var shp2json = require('shp2json')
var tako = require('tako')
var geohash = require('geohash').GeoHash
var JSONStream = require('JSONStream')
var async = require('async')
var gju = require('geostuff')
var t = tako()
@samdelagarza
samdelagarza / latency.txt
Created May 31, 2012 20:20 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@csanz
csanz / hackathons101.md
Created April 29, 2012 15:41
Hackathons 101

Summary

Just some quick notes on how to create a hackathon, super simple really.

Sponsors & Judges

  • Prepare one page summary of the event (Name, venue, audience numbers)
  • Reach out to tech evangelist from various companies, offer 10 minutes to pitch their APIs (skype or in person)
  • Reach out to influential hackers to be judges and includes sponsors
@domenic
domenic / example.js
Last active May 25, 2018 10:17
Promise chaining example
// `promise` is some operation that may succeed (fulfill) or fail (reject)
var newPromise = promise.then(
function () {
return delay(1000);
},
writeError
);
// If `promise` fulfills, `newPromise` will fulfill in 1000 ms.
// If `promise` rejects and writing to the error log succeeds,
@torgeir
torgeir / install_redis_on_ubuntu.md
Last active June 7, 2018 17:44 — forked from lucasmazza/script.md
Redis 2.4.8 Install on Ubuntu 10.04

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ tar xvfz redis-2.4.8.tar.gz 
$ cd redis-2.4.8/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis
@addyosmani
addyosmani / mediator.md
Created February 15, 2012 17:01
Mediators

The dictionary refers to a Mediator as 'a neutral party who assists in negotiations and conflict resolution'.

In software engineering, a Mediator is a behavioural design pattern that allow us to expose a unified interface through which the different parts of a system may communicate. If it appears a system may have too many direct relationships between modules, it may be time to have a central point of control that modules communicate through instead. The Mediator promotes loose coupling by ensuring that instead of modules referring to each other explicitly, their interaction is handled through this central point.

If you would prefer an analogy, consider a typical airport traffic control system. A tower (Mediator) handles what planes (modules) can take off and land because all communications are done from the planes to the control tower, rather than from plane-to-plane. A centralized controller is key to the success of this system and that's really the role a mediator plays in software design.

In real-worl