Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jBenes on github.
  • I am benes (https://keybase.io/benes) on keybase.
  • I have a public key whose fingerprint is 0056 115C CDA6 DA22 4190 214E 328B EEA6 ACD7 4448

To claim this, I am signing this object:

import requests
import ujson
from time import sleep
from random import randint
from datetime import datetime, timedelta
#just for pretty printing
from pprint import pprint
from uuid import uuid4
def search_flight(datetime_from=None, datetime_to=None):
@jBenes
jBenes / singleton.py
Last active August 29, 2015 14:27 — forked from 1st/singleton.py
Singleton implantation on Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Singleton(type):
def __call__(self, *args, **kwargs):
if 'instance' not in self.__dict__:
self.instance = super(Singleton, self).__call__(*args, **kwargs)
return self.instance
import csv
import argparse
from collections import defaultdict
def load_routes(routes_file=None):
routes = defaultdict(set)
if routes_file:
with open(routes_file) as lines:
for line in lines:
src,dst = line.replace("\r","").replace("\n","").split("\t")[:2]
import requests
import ujson
from pprint import pprint
from random import SystemRandom
from string import digits, ascii_uppercase
from time import sleep
possible_characters = ascii_uppercase + digits
def gp(length=32):
@jBenes
jBenes / ng-fb-adapter.js
Created October 12, 2014 19:41
ng-fb-adapter - usage
angular.module('myModule', [
'facebook-integration'
])
.config(function(..., fbAdapterProvider) {
var adapter = 'OpenFBAdapter';
if(window.cordova) {
adapter = 'facebookConnectPluginAdapter';
}
/**
* OpenFB is a micro-library that lets you integrate your JavaScript application with Facebook.
* OpenFB works for both BROWSER-BASED apps and CORDOVA/PHONEGAP apps.
* This library has no dependency: You don't need (and shouldn't use) the Facebook SDK with this library. Whe running in
* Cordova, you also don't need the Facebook Cordova plugin. There is also no dependency on jQuery.
* OpenFB allows you to login to Facebook and execute any Facebook Graph API request.
* @author Christophe Coenraets @ccoenraets
* @version 0.4
*/
var openFB = (function () {