Skip to content

Instantly share code, notes, and snippets.

@rudyryk
rudyryk / HyperShortcuts.h
Created April 27, 2014 15:41
Objective-C and Cocoa shortcuts for iOS development
//
// HyperShortcuts.h
// Created by Alexey Kinyov on 27/04/2014.
//
// The MIT License (MIT)
//
// Copyright (c) 2013 Alexey Kinyov <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@rudyryk
rudyryk / django_minicart.py
Last active August 29, 2015 14:01
Simple and agnostic session based cart for Django
# -*- coding: utf-8 -*-
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Agnostic minimal session based cart for Django.
Just copy-n-paste this snippet to your project.
See `Cart` class reference below for details.
@rudyryk
rudyryk / flask_admin_helpers.py
Last active August 29, 2015 14:07
Flask-Admin simple helpers: require login mixing, serving protected static pages. Snippet is written for Python 3.x
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""
Flask-Admin simple helpers
==========================
Just copy and paste to some of your helpers or base classes module, import and use.
You'll also need to install Flask-Login for using authentication.
@rudyryk
rudyryk / powerdnsclient.py
Last active August 29, 2015 14:08
Simple client for PowerDNS.net service API
# -*- coding: utf-8 -*-
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""
Simple client for PowerDNS.net service API.
"""
from suds.client import Client as BaseClient
@rudyryk
rudyryk / redis_asyncio_mq_demo.py
Last active September 19, 2024 12:35
Simple message queue demo on Redis LPUSH / BRPOP for Python 3.3+ and asyncio.
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Simple message queue demo on Redis LPUSH / BRPOP for Python 3.3+ and asyncio.
See also "Pattern: Reliable queue" at http://redis.io/commands/rpoplpush to get
an idea for improvement.
"""
import asyncio
import aioredis
@rudyryk
rudyryk / merge_tumblr_blogs.py
Last active September 20, 2019 15:04
Merging Tumblr blogs Python script.
# -*- coding: utf-8 -*-
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Merge Tumblr blogs helper.
Load posts from one ("old") blog and copy them to another ("new") one.
The script also tries to prevent duplicates if it will run multiple
times.
@rudyryk
rudyryk / build_ios_resizes.py
Created December 23, 2014 10:30
Create retina @2x and non-retina resized images from @3x sized images
#!/usr/bin/env python
import os
import sys
print(sys.executable)
def resize_images_in_path(path, out_dir, imagemagic=False):
"""Build 2x and 1x downsized images by 3x images in directory."""
dirs = os.listdir(path)
@rudyryk
rudyryk / Countdown.cs
Last active November 1, 2020 23:46
C# — countdown timer with periodical ticks + Xamarin.Forms binding helper + Basic usage example
//
// Countdown.cs
// Created by Alexey Kinev on 11 Jan 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <[email protected]>
//
using System;
@rudyryk
rudyryk / Badge.cs
Last active September 5, 2024 09:51
C# — Xamarin.Forms custom simple badge view + rounded box view via custom renderer
//
// Badge.cs
// Created by Alexey Kinev on 19 Jan 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <[email protected]>
//
using System;
@rudyryk
rudyryk / redactor.imagelink.js
Last active March 26, 2018 11:16
Plugin for Imperavi Redactor v10.x.x -- Insert image by link (feature is missing by default)