Skip to content

Instantly share code, notes, and snippets.

Ihor Kaharlichenko kaharlichenko

  • Cracow, Poland
Block or report user

Report or block kaharlichenko

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
@t-8ch
t-8ch / test_ssl.py
Created Feb 24, 2015
triage kennethreitz/request#2455
View test_ssl.py
import subprocess
import pytest
class Interpreter(object):
base = '/usr/bin/python'
def __init__(self, suffix):
self.suffix = suffix
@noelwelsh
noelwelsh / Example.scala
Created Feb 20, 2015
Robust Error Handling in Scala
View Example.scala
import scalaz.\/
import scalaz.syntax.either._
object Example2 {
// This example simulates error handling for a simple three tier web application
//
// The tiers are:
// - the HTTP service
// - a user authentication layer
// - a database layer
@NotSqrt
NotSqrt / settings_test_snippet.py
Last active Aug 7, 2019 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
View settings_test_snippet.py
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@jpetazzo
jpetazzo / gist:6127116
Created Jul 31, 2013
Debian/Ubuntu containers protips, thanks to @spahl
View gist:6127116
# this forces dpkg not to call sync() after package extraction and speeds up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
# we don't need and apt cache in a container
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
@j4mie
j4mie / middleware.py
Created May 5, 2011
Django middleware to log the total number of queries run and query time for every request
View middleware.py
from django.db import connection
from django.utils.log import getLogger
logger = getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
View polymorphic.py
'''Manager-based polymorphic model inheritance.
This module provides a non-intrusive approach for accessing polymorphically
instances of a model hierarchy. Non-intrusive means:
- It does not require extending a custom ``Model`` base class or metaclass.
- It does not require a ``ForeignKey`` to ``ContentType`` or the ``contenttypes``
app in general. Instead the real class of an instance is determined based on
the value (**polymorphic identity**) of a user-specified discriminating field
(**polymorphic on**).
- It does not override the default (or any other) model ``Manager`` (unless
View jquery.textchange.js
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
You can’t perform that action at this time.