Skip to content

Instantly share code, notes, and snippets.

View sieroshtan's full-sized avatar
:shipit:
What's happening?

Alex Sieroshtan sieroshtan

:shipit:
What's happening?
  • Kharkiv, Ukraine
View GitHub Profile
@maximbilan
maximbilan / gist:b7cbd88f4ddac52eec59
Last active August 29, 2015 14:26
UIImage from text
+ (UIImage *)imageFromText:(NSString *)text size:(CGSize)size fontName:(NSString *)fontName maxFontSize:(CGFloat)maxFontSize minFontSize:(CGFloat)minFontSize
{
UIFont *font;
CGSize fontSize;
for (CGFloat maxSize = maxFontSize; maxSize >= minFontSize; maxSize -= 1.f) {
font = [UIFont fontWithName:fontName size:maxSize];
fontSize = [text sizeWithAttributes:@{ NSFontAttributeName : font }];
if (fontSize.width <= size.width) {
@cyface
cyface / child_create.html
Created July 21, 2012 22:29
Django Many-To-Many Create With Intermediary (Through) Table
{% extends "base.html" %}
{% block content %}
<section title="Child Create" data-role="content">
<h2>Child Create</h2>
<form action="{% url child_create slug=form.family_slug.value %}" method="POST">
{{ form.errors }}
{% csrf_token %}
<ul>
@kachayev
kachayev / tic-tac-toe.py
Created November 22, 2011 23:50
Tornado demo application: TCP server to tic-tac-toe multiplayer game
"""Simple TCP server for playing Tic-Tac-Toe game.
Use Player-to-Player game mode based on naming auth.
No thoughts about distribution or pub/sub mode
(for monitoring or something like this). Just
basic functionality.
"""
import time
import logging