Skip to content

Instantly share code, notes, and snippets.

View Lweek's full-sized avatar

Vladimír Bělohradský Lweek

View GitHub Profile
@Lweek
Lweek / breakLongWords.php
Created January 6, 2016 17:20
PHP function to break long words
<?php
/**
* Detect overly long words in text and add whitespaces into them to let them wrap
* @param string $text Text to be processed
* @return string
* @author Vladimir Belohradsky
*/
function breakLongWords($text) {
$maxWordLenght = 30;
$words = explode(' ',$text);
@Lweek
Lweek / UIImage_qrcode.swift
Created August 1, 2015 08:35
Generate QR code
//
// UIImage-QRCodeGenerator.swift
//
// Created by Vladimír Bělohradský on 09/07/15.
//
import QuartzCore
import UIKit
extension UIImage {
@Lweek
Lweek / BinaryWise.php
Created May 11, 2015 03:19
Smart binary operations in PHP
<?php
//
// Bitwise operations can save memory! And looks smart! :)
// It is possible use short binary chain as settings registry
// Note: PHP 5.4+ knows how to use 0b binary format, older
// version can use bindec() function or just use your brain!
//
// @author Vladimir Belohradsky
//