Skip to content

Instantly share code, notes, and snippets.

View Khazbs's full-sized avatar
🐺
.let { it.be() }

Arthur Khazbulatov Khazbs

🐺
.let { it.be() }
  • TelePat, LLC
  • Moscow, Russia
  • 15:20 (UTC +03:00)
View GitHub Profile
# -*- coding: utf-8 -*-
def transliterate(string):
capital_letters = {u'А': u'A',
u'Б': u'B',
u'В': u'V',
u'Г': u'G',
u'Д': u'D',
u'Е': u'E',
@startling
startling / naive_sets.py
Created April 3, 2012 05:14
russell's paradox in python
class Set(object):
"""Sets can contain anything, including themselves. This leads to
paradoxical behavior: given R, the set of all sets that don't contain
themselves, does R contain R? Here this becomes an infinite recursion.
"""
def __init__(self, predicate):
self.predicate = predicate
def __contains__(self, obj):
return self.predicate(obj)
@MadLittleMods
MadLittleMods / jquery-parent-to-animate.js
Last active June 4, 2021 11:52
Transition/Animate move to new parent - jQuery plugin
// Usage:
// $('.box').parentToAnimate($('.new-parent'), 200);
// $('.box').parentToAnimate($('.new-parent'), 'slow');
// $('.box').parentToAnimate('.new-parent', 'slow');
jQuery.fn.extend({
// Modified and Updated by MLM
// Origin: Davy8 (http://stackoverflow.com/a/5212193/796832)
parentToAnimate: function(newParent, duration) {
duration = duration || 'slow';
@garystafford
garystafford / random-status.go
Last active March 24, 2024 12:21
Simple HTTP server that returns random HTTP status code, written in Go
// Simple HTTP server that returns random HTTP status code, written in Go.
// Author: Gary A. Stafford <garystafford@rochester.rr.com>
// Created: 11/04/2016
package main
import (
"io"
"math/rand"
"net/http"
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 18, 2024 11:20
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@paolocarrasco
paolocarrasco / README.md
Last active July 17, 2024 04:36
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@vganin
vganin / ComposePathMorphing.kt
Last active March 16, 2023 15:34
Jetpack Compose path morphing animation
@Composable
fun animatePathAsState(path: String): State<List<PathNode>> {
return animatePathAsState(remember(path) { addPathNodes(path) })
}
@Composable
fun animatePathAsState(path: List<PathNode>): State<List<PathNode>> {
var from by remember { mutableStateOf(path) }
var to by remember { mutableStateOf(path) }
val fraction = remember { Animatable(0f) }