Skip to content

Instantly share code, notes, and snippets.

Zohaib Sibte Hassan maxpert

Block or report user

Report or block maxpert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxpert
maxpert / decay_ranking.py
Created Jun 15, 2014
Decayed ranking basic implementation
View decay_ranking.py
import math
import operator
class DecayScore(object):
"""
Class for calculating basic decayable score over keys (items) and there score values.
It's not thread safe and not doesn't store anykind of timestamps against items stored.
The caller is responsible of keeping track of time.
"""
@maxpert
maxpert / hash_test.go
Created Mar 16, 2015
JumpConsistentHash
View hash_test.go
package main
import "fmt"
type hash_function func (uint64, int32) int32
func main() {
for j := 1; j < 32; j++ {
simulate_rebalance("JumpConsistentHash", 32, int32(32 + j), JumpConsistentHash)
simulate_rebalance("ModConsistentHash", 32, int32(32 + j), ModConsistentHash)
@maxpert
maxpert / cookie.js
Created Jun 2, 2011
Cookie Wrapper
View cookie.js
@maxpert
maxpert / autoscroll.js
Created Oct 15, 2011
Minimal jQuery Autoscroll to top
View autoscroll.js
(function(jq) {
jq.autoScroll = function(ops) {
ops = ops || {};
ops.styleClass = ops.styleClass || 'scroll-to-top-button';
var t = jq('<div class="'+ops.styleClass+'"></div>'),
d = jq(ops.target || document);
jq(ops.container || 'body').append(t);
t.css({
opacity: 0,
@maxpert
maxpert / HDD info
Created Jun 10, 2012
TokyoCabinet + LZ4 speedups
View HDD info
/dev/sda:
ATA device, with non-removable media
Model Number: ST3250312AS
Serial Number: Z2A1KYYX
Firmware Revision: JC45
Transport: Serial
Standards:
Used: unknown (minor revision code 0x0029)
Supported: 8 7 6 5
@maxpert
maxpert / .vimrc
Created Jun 30, 2012
Vim configuration
View .vimrc
set nocp
set bs=indent,eol,start
syntax on
set gcr=n:blinkon0
set sw=2 sts=2 et
set number ai
@maxpert
maxpert / entitiy_example.json
Created Sep 27, 2012
PostgreSQL vs MySQL FriendFeed casestudy
View entitiy_example.json
{
"id": "71f0c4d2291844cca2df6f486e96e37c",
"user_id": "f48b0440ca0c4f66991c4d5f6a078eaf",
"feed_id": "f48b0440ca0c4f66991c4d5f6a078eaf",
"title": "We just launched a new backend system for FriendFeed!",
"link": "http://friendfeed.com/e/71f0c4d2-2918-44cc-a2df-6f486e96e37c",
"published": 1235697046,
"updated": 1235697046,
}
@maxpert
maxpert / Readme.md
Last active Dec 11, 2015
[Portable Class Library] WeakLambda implementation (can be used to make replacement of WeakEventManager in PCL environments).
View Readme.md

Nuts and bolts for a Portable Class Library WeakEventManager

I spent my whole day (as a hobby) figuring out how can I implement equivalent of WeakEventManager. After a whole lot of digging around I concluded that I need a basic WeakLambda or WeakAction implementation. This implementation in-turn can be used by anything ranging from bulding WeakEvents, to WeakEventManager.

You are free to copy, rewrite, distribute code! May you never do bad and share the love!

Zohaib Sibte Hassan

@maxpert
maxpert / benchmarks-dump.txt
Created Mar 27, 2013
Go code to benchmark memcached binary and ASCII protocol.
View benchmarks-dump.txt
=========================
Testing with 100,000 gets
=========================
ASCII test...
ASCII 6.560225s
Binary test...
Binary 5.288102s
View Readme.md

Javascript #router. Features:

  • Just 70 lines of code.
  • Router scope can be bound to any object (default window); just change first parameter
  • Triggers custom DOM (Level 2) events on window.document.
  • IE 9+, FF, and Webkit based browsers [Tested only in Chrome and FF].
You can’t perform that action at this time.