Skip to content

Instantly share code, notes, and snippets.

@facultymatt
facultymatt / roles_invesitgation.md
Last active April 16, 2024 09:31
Roles and permissions system for Nodejs
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@Chris2048
Chris2048 / sse example
Last active October 10, 2015 12:08
example use of sse
#!/bin/python2.7
# -`*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import flask
app = flask.Flask(__name__)
app.debug = True
app.secret_key = 'asdf'
@Chris2048
Chris2048 / flask sse
Last active October 10, 2015 10:58
Server-Side Events in flask
#!/bin/python2.7
# -`*- coding: utf-8 -*-
"""
test for Server-Side events in flask
inspiration from:
http://www.html5rocks.com/en/tutorials/eventsource/basics/
https://github.com/niwibe/sse.git
https://github.com/niwibe/django-sse.git
@desaiashu
desaiashu / app.py
Last active August 15, 2023 18:27
Sample Heroku Flask app with MongoHQ
import os
from urlparse import urlparse
from flask import Flask
from pymongo import MongoClient
MONGO_URL = os.environ.get('MONGOHQ_URL')
if MONGO_URL:
# Get client
client = MongoClient(MONGO_URL)
@tuzz
tuzz / github.css
Last active July 17, 2024 06:55
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@maccman
maccman / juggernaut_channels.rb
Created June 26, 2012 04:56
Sinatra Server Side Event streaming with private channels.
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@Jud
Jud / Price-Time Matching Engine.c
Created June 1, 2012 23:56
Price-Time Matching Engine
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
@gdamjan
gdamjan / eventsource.py
Last active September 30, 2015 14:08
This is a python/gevent reimplementation of this EventSource demo https://github.com/remy/eventsource-h5d/
#! /usr/bin/env python2
'''\
This is a reimplementation of a node.js demo of the Server-Sent Events API.
You can find (and compare to) the node.js version at https://github.com/remy/eventsource-h5d/.
'''
from werkzeug import Request, Response, redirect
from werkzeug.wsgi import SharedDataMiddleware