Skip to content

Instantly share code, notes, and snippets.

View stagas's full-sized avatar
🤸

stagas stagas

🤸
View GitHub Profile
@stagas
stagas / design-web-lang.md
Last active August 11, 2023 07:27
Design draft for a high-level Web language.

Design draft for a high-level Web language.

  • Good editor support.
  • Good package management and distribution channels.
  • Good interfaces.
    • All modern goodies - Pattern matching, Tuple/Records, ?
    • First-class Reactive interfaces.
    • JSX (or any style XML-in-lang, first-class)
  • Good interoperability.
  • Quick to compile.
@stagas
stagas / how-to-run-apache-and-node.js-together-the-right-way.markdown
Created December 24, 2010 14:45
How to run Apache and Node.js together (the right way)

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

@stagas
stagas / TestFboChangeBuffer.cpp
Created September 11, 2020 15:48 — forked from roxlu/TestFboChangeBuffer.cpp
Comparing the performance of different ping/pong techniques when using FBOs. One version uses two fbos and swaps between these, the other switches the draw and read buffer. See these results https://docs.google.com/spreadsheets/d/1ZyTQGkjYQajQtu8OvgRyaXJl46F4rZJStBCEK2kebgE/edit?usp=sharing for a comparison. It seems that switching read / draw b…
#include <poly/Log.h>
#include <TestFboChangeBuffer.h>
using namespace poly;
TestFboChangeBuffer::TestFboChangeBuffer()
:fbo(0)
,dx(0)
{
tex[0] = 0;
@stagas
stagas / urlscrape.js
Created December 2, 2010 08:42
urls from text to array
var str = 'mvo ienroisjer http://bit.ly/sCraPeD apowi oiuo http://foo.com/bar/zoo fapowiep oit'
var regex = new RegExp('(?:(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-Z0-9+&@#/%?=~_|$!:,.;]*[-A-Z0-9+&@#/%=~_|$]\|((?:mailto:)?[A-Z0-9._%+-]+@[A-Z0-9._%-]+\.[A-Z]{2,4})\\b)|"(?:(?:https?|ftp|file)://|www\.|ftp\.)[^"\r\n]+"?|\'(?:(?:https?|ftp|file)://|www\.|ftp\.)[^\'\r\n]+\'?', 'gi')
, arr = str.match(regex)
console.log(arr)
@stagas
stagas / LICENSE.txt
Created May 26, 2011 06:58 — forked from 140bytes/LICENSE.txt
Padding for Strings and Numbers
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 George Stagas https://github.com/stagas
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@stagas
stagas / reexport.js
Created January 13, 2013 15:54
example passing deps around with exports.
// common.js
exports.app = require('./app')
exports.db = require('./db')
// app.js
var common = require('./common')
var db = common.db
var app = module.exports = express()
var n = +(process.argv[2] || 10000)
var cp = require('child_process')
var child = cp.fork(__dirname + '/worker.js')
console.log('trying', n, 'messages')
var total = n
child.on('message', function () {
if (!--total) console.log('completed %d roundtrips', n - total)
@stagas
stagas / a.js
Created March 17, 2012 11:57
test for global leak
module.exports = foo = 'hello'
@stagas
stagas / protocol.js
Created December 31, 2011 11:41
Thinking about a human-readable multi-line pubsub api for irc bots...
var EventEmitter = require('events').EventEmitter,
util = require('util');
// TODO:
// * tags (BEGIN somehashhere\nsomehashhere data)
// * line numbers (begin somehash\nsomehash:12 data)
var Buffer = exports.Buffer = function (o) {
o = o || {};
@stagas
stagas / nextTick-for-browser.js
Created September 18, 2011 18:59
nextTick implementation for the browser
// nextTick - by stagas / public domain
var nextTick = (function () {
var queue = [];
var dirty = false;
var fn;
var hasPostMessage = !!window.postMessage;
var messageName = 'nexttick';
var trigger = (function () {
return hasPostMessage
? function trigger () {