Skip to content

Instantly share code, notes, and snippets.

View ultimateprogramer's full-sized avatar

Ahmed Maawy ultimateprogramer

View GitHub Profile
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active December 24, 2025 06:08
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@jczaplew
jczaplew / pgFormatDate.js
Created April 24, 2015 14:11
Javascript Date to Postgres-acceptable format
// Convert Javascript date to Pg YYYY MM DD HH MI SS
function pgFormatDate(date) {
/* Via http://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date */
function zeroPad(d) {
return ("0" + d).slice(-2)
}
var parsed = new Date(date)
@mchow01
mchow01 / TWTR-mongo.py
Created March 16, 2015 20:13
Store tweets from a Twitter timeline into a Mongo database using Tweepy
import tweepy
import pymongo
# Tweepy API doc here: http://pythonhosted.org/tweepy/html/api.html
# PyMongo API doc here: https://pypi.python.org/pypi/pymongo/
# Keys
consumer_key = ''
consumer_secret = ''
access_token = ''
@martinrusev
martinrusev / cron_supervisord.ini
Last active May 6, 2025 09:49
Cron supervisord
[supervisord]
nodaemon=true
loglevel=debug
[program:amon]
command=gunicorn -c gunicorn.conf.py wsgi
directory=/amon
autostart=true
autorestart=true
redirect_stderr=true
@barnabyc
barnabyc / routes.js
Last active May 4, 2025 21:43
Aviator/React example
import Aviator from 'vendor/aviator';
import ServerRouteTarget from 'route_targets/server_route_target';
let Routes = {
/**
Call this method `Routes.dispatch` to start routing.
@method dispatch
@param {Object} targets
@example { 'nameOfMyRouteTarget': instanceOfMyRouteTarget }
@jah2488
jah2488 / raycast.hx
Created April 29, 2014 18:56
A simple raycasting proof of concept I did a few months back in haxe/openfl. Think of the original doom. Its kinda like that.
package;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.Lib;
import flash.ui.Keyboard;
import flash.Vector;
@hojberg
hojberg / app_route_target.js
Last active September 5, 2019 09:36
Simple Aviator/React example. Read more about Aviator here: https://github.com/swipely/aviator
/** @jsx React.DOM */
var AppRouteTarget = {
setupLayout: function () {
React.renderComponent({
<App className='page-content'>,
document.querySelector('body')
});
}
};
@pbojinov
pbojinov / README.md
Last active November 5, 2025 23:10
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@miohtama
miohtama / gist:7814435
Last active July 13, 2020 19:48
Minimal Bitcoin <-> currency exchange rate converter using bitcoinaverage.com API.
"""
Minimal Bitcoin <-> currency exchange rate converter using bitcoinaverage.com API.
Do HTTP fetches using request library.
http://bitcoinaverage.com
http://docs.python-requests.org/en/latest/index.html
@katowulf
katowulf / 1_using_queries.js
Last active April 24, 2023 07:14
Methods to search for user accounts by email address in Firebase
/***************************************************
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
***************************************************/
var fb = firebase.database.ref();
/**
* @param {string} emailAddress