Skip to content

Instantly share code, notes, and snippets.

View hkulekci's full-sized avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
from collections import deque
class Edge(object):
def __init__(self, _id, data):
self.id = _id
self.data = data
def __str__(self):
return "Edge {}".format(self.id)
import redis
r = redis.Redis()
base = 0 # Smallest allowed key in samples
jump = 50 # Key size bins
top = 1300 # Largest allowed key in sample
samples = 1000 # Numbers of samples
bins = []
for i in xrange(1+(top-base)/jump):
@ezimuel
ezimuel / test.php
Created August 10, 2015 13:29
Unit test for RouteMiddlewareTest issue #40 zend-expressive
<?php
/**
* Get the router adapters installed
*/
public function getRouterAdapters()
{
$adapters = [];
if (class_exists('Aura\Router\Router')) {
$adapters[] = [ 'Zend\Expressive\Router\Aura' ];
}
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
namespace ConsoleApplication1
{
class Program
@tbranyen
tbranyen / client.js
Created June 3, 2011 02:29
Synchronize yo HTML5 slides
(function(window, document) {
// The end user should be allowed to disable synchronization. This button
// is optional on the page
var syncAllow = true;
var syncButton = document.querySelector('.sync-button');
// If the sync button exists bind a click event and toggle the syncAllow
// boolean. Set the value of the button.
if(syncButton) {
@mdigital
mdigital / gist:1094836
Created July 20, 2011 12:01 — forked from paulirish/gist:366184
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
;(function(geolocation){
if (geolocation) return;
var cache;
@jdelisle
jdelisle / AbstractResourceListener.php
Last active September 29, 2015 10:21
Query string parameters validation for Zend's Apigility resource fetchAll method
<?php
namespace Application\Rest;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use Zend\Stdlib\Parameters;
use ZF\ApiProblem\ApiProblem;
use ZF\Rest\ResourceEvent;
abstract class AbstractResourceListener extends \ZF\Rest\AbstractResourceListener {
@mkorkmaz
mkorkmaz / DetermineDSNForPDO.php
Last active December 12, 2015 06:28
Determine dsn string for PDO to connect multiple nodes. If one node is down, removes it ASAP ( in this script it takes max 15 secs )
<?php
class DetermineDSNForPDO{
public $dsn = '';
public $system_failover = FALSE;
@hanksudo
hanksudo / Python.sublime-build
Created March 11, 2013 04:36
Build Python program on Sublime Text
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env":{
"PYTHONPATH": "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages"
}
}
@felipecruz
felipecruz / url_shortener.py
Created April 11, 2013 23:09
tiny url shortener
import re
'''
pip install flask
pip install coopy
'''
from coopy.base import init_persistent_system
from flask import Flask, request, redirect, jsonify