Skip to content

Instantly share code, notes, and snippets.

View maxvyaznikov's full-sized avatar

Max Vyaznikov maxvyaznikov

View GitHub Profile
@amacneil
amacneil / json.py
Last active March 18, 2021 03:24
Safely JSON-encode objects in your Django template
from django.core.serializers.json import DjangoJSONEncoder
from django.template import Library
from json import dumps as json_dumps
register = Library()
@register.filter
def json(data):
"""
@arademaker
arademaker / processing.py
Created July 17, 2014 13:15
using freeling from Python
#!/opt/local/bin/python3.2
# -*- encoding: utf-8 -*-
import sys
import json
sys.path.append('.../myfreeling/APIs/python')
import freeling
import codecs
import re
@clintberry
clintberry / gist:5811856
Created June 19, 2013 05:24
using callbacks instead of promises for angular websocket service
angular.module('MyApp').factory('MyService', ['$q', function($q) {
// We return this object to anything injecting our service
var Service = {};
// Keep all pending requests here until they get responses
var callbacks = {};
// Create a unique callback ID to map requests to responses
var currentCallbackId = 0;
// Create our websocket object with the address to the websocket
var ws = new WebSocket("ws://localhost:8000/socket/");
@vitalyrotari
vitalyrotari / touch.js
Last active October 22, 2021 22:01
jQuery Touch Gestures
jQuery Touch Gestures ported from QUOjs
@see http://quojs.tapquo.com/
Version 1.1
-- @add singleTap event
-- @fix doubleTap event
-- @fix hold event
@telamon
telamon / socksproxy.js
Created August 5, 2011 12:42
Socks5 proxy implementation in Node.JS
// http://www.ietf.org/rfc/rfc1928.txt
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar
var States = {
CONNECTED:0,
VERIFYING:1,
READY:2,
PROXY: 3
};
@mattcg
mattcg / flashpolicy.xml
Created July 25, 2010 20:05
A simple Flash socket policy server for NodeJS.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket://socks.example.com -->
<cross-domain-policy>
<!-- This is a master socket policy file -->
<!-- No other socket policies on the host will be permitted -->
<site-control permitted-cross-domain-policies="master-only"/>