Skip to content

Instantly share code, notes, and snippets.

View ahmetvurgun's full-sized avatar

Ahmet Vurgun ahmetvurgun

View GitHub Profile
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
forwardMap = {
5500 : [ "192.168.110.32:5500", "10.0.1.1:5500" ],
5499 : [ "192.168.110.32:5499" ],
15501 : [ "localhost:5501" ]
}
@geoffb
geoffb / simple_websocket_client.html
Created October 7, 2010 23:37
Super simple websockets client/server using Python. Compatible with the draft 76 challenge/response.
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebSocket Client</title>
<style>
#output {
border: solid 1px #000;
}
</style>
</head>
@noqisofon
noqisofon / gist:788988
Created January 21, 2011 00:07
XMLHttpRequest を使うサンプルを書きなおしてみた感じ
function getXMLHttpRequest() {
if ( _root.defined( `XMLHttpRequest ) )
return new XMLHttpRequest();
else {
try {
return ActiveXObjectFactory.createObject( "MSXML2.XMLHTTP.3.0" );
} catch ( e : Exception ) {
return null;
}
}
@gabrielgilini
gabrielgilini / xhr.js
Created September 22, 2011 13:53
Simple XMLHttpRequest example
(function()
{
var global = this;
var createXmlHttpRequest = (function()
{
var i,
fs = [// for legacy eg. IE 5
function()
{
@yorikvanhavre
yorikvanhavre / pyjs.py
Created April 9, 2012 00:30
call pyqt4 stuff from javascript
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
import WebGui
"""Html snippet."""
html = """
<html><body>
<center>
<script language="JavaScript">
document.write('<p>Python ' + pyObj.pyVersion + '</p>')
@noonien
noonien / async_loader.js
Created July 16, 2012 17:36
Asynchronous Javascript/CSS loader.
AL = function(type, url, callback) {
var el, doc = document;
switch(type) {
case 'js':
el = doc.createElement('script');
el.src = url;
break;
case 'css':
el = doc.createElement('link');
@daneden
daneden / dabblet.css
Created October 10, 2012 09:26
CSS Photo Album
/* CSS Photo Album */
/* Rebound of this shot by @daryl: http://drbl.in/fwwM */
* {
margin: 0;
padding: 0;
position: relative;
box-sizing: border-box;
}
@zhchbin
zhchbin / index.html
Created November 30, 2012 02:09
Node-webkit hotkey api proposal
<!DOCTYPE>
<html>
<head>
<title>Hotkey Demo</title>
<script type="text/javascript" src='keymap.js'></script>
<script type="text/javascript">
function log(message) {
document.getElementById('log').textContent += message + '\n';
}
var gui = require('nw.gui');
@beaspider
beaspider / lazyload.js
Created December 6, 2012 15:41
lazy load js
// can be used for JSONP calls too
var loadScript = function(url, callback) {
var script = document.createElement('script');
script.setAttribute('src', url);
script.setAttribute("type","text/javascript");
script.setAttribute('async', true);
// wait for script to load
var onLoaded = function(script,callback) {
return function() {
// remove the script
@marvin
marvin / client.py
Created December 17, 2012 13:50
simple python client/server socket binary stream
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST,PORT)
BUFSIZE = 4096
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4"
bytes = open(videofile).read()