Skip to content

Instantly share code, notes, and snippets.

Jiří Beneš jBenes

View GitHub Profile
View keybase.md

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:

View sp_booking.py
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 Aug 29, 2015 — forked from 1st/singleton.py
Singleton implantation on Python
View singleton.py
#!/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
View am_csv.py
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]
View dohop.py
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 Oct 12, 2014
ng-fb-adapter - usage
View ng-fb-adapter.js
angular.module('myModule', [
'facebook-integration'
])
.config(function(..., fbAdapterProvider) {
var adapter = 'OpenFBAdapter';
if(window.cordova) {
adapter = 'facebookConnectPluginAdapter';
}
View openfb.js
/**
* 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 () {
You can’t perform that action at this time.