Skip to content

Instantly share code, notes, and snippets.

import optparse
import sys
def populate_with_regex(expr):
# return list of int ids
return [1, 2, 3]
def do_business_with_devices_list(lst):
print("business: %s" % repr(lst))
diff --git a/examples/pgsql/src/pgsql.c b/examples/pgsql/src/pgsql.c
index 3553bfc..e377b7d 100644
--- a/examples/pgsql/src/pgsql.c
+++ b/examples/pgsql/src/pgsql.c
@@ -126,6 +126,9 @@ request_perform_query(struct http_request *req)
{
struct rstate *state = req->hdlr_extra;
+ kore_pgsql_cleanup(&state->sql);
+ return HTTP_STATE_COMPLETE;
def minimal(req):
req.response(200, b'')
return kore.RESULT_OK
@stan1y
stan1y / ajax.js
Created March 13, 2012 09:31
Tiny AJAX lib
ajax = {
getHTTPObject : function() {
var http = false;
//Use IE's ActiveX items to load the file.
if(typeof ActiveXObject != 'undefined') {
try {http = new ActiveXObject('Msxml2.XMLHTTP');}
catch (e) {
try {http = new ActiveXObject('Microsoft.XMLHTTP');}
catch (E) {http = false;}
}
- (StellarPosition) getOribitOf:(StellarObject*)target;
{
//find intersection of line (position.x, position.y)..(target.x, target.y)
//with circle around (target.x, target.y) with radius 'orbitRadius'
//current angle to target
double angleRadians = [self angleTo:[target position]];
//get point with angle on circle with R=orbitRadius, center (target.x, target.y)
double pointX = [target position].x + orbitRadius * cos(angleRadians);
/*
Language: Objective C
ObjC keywords & classes for highlight.js (c) Stanislav Yudin <decvar@gmail.com>
*/
hljs.LANGUAGES.objc = function(){
var OBJC_KEYWORDS = {
'keyword': { 'IBAction' : 10, 'IBOutlet' : 10, 'atomic': 5, 'nonatomic': 5, 'assign' : 5, 'NO' : 2, 'BOOL' : 1, 'id' : 1, 'int': 1, 'float': 1, 'while': 1, 'char': 1, 'protocol': 3, 'catch': 1, 'selector': 2, 'encode': 1, 'export': 2, 'sizeof': 2, 'self': 2, 'property' : 2, 'synchronized': 2, 'typedef': 2, 'alloc': 2, 'const': 1, 'struct': 1, 'for': 1, 'retain': 2, 'union': 1, 'release': 2, 'super' : 2, 'autorelease' : 2, 'import': 1, 'unsigned': 1, 'long': 1, '\@throw': 1, 'static': 1, 'bool': 1, 'if': 1, 'public': 1, 'do': 1, 'return': 1, 'goto': 1, 'void': 2, 'enum': 1, 'else': 1, 'break': 1, 'YES': 2, 'class': 1, 'asm': 1, 'case': 1, 'typeid': 1, 'short': 1, 'double': 1, 'implementation': 2, 'interface': 2, 'end': 1, 'signed': 1, 'typename': 1, 'try': 1, 'finally': 1, 'switch': 1, 'continue': 1, 'inline': 1},
'built_in': { }
};
/*
XCode colors for highlight.js (c) Stanislav Yudin <decvar@gmail.com>
*/
pre code {
display: block;
background: white; color: #000;
border: solid #CCC 1px;