Skip to content

Instantly share code, notes, and snippets.

View rolandkakonyi's full-sized avatar

Roland Kákonyi rolandkakonyi

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, json, argparse
print os.getcwd()
parser = argparse.ArgumentParser(description='Convert color assets from storyboards and xibs')
parser.add_argument('--colorSpace', dest="color_space",
type=str,
@rolandkakonyi
rolandkakonyi / resizeLabelFont.m
Created July 17, 2018 08:42
UILabel auto font size
- (void)resizeFontForLabel:(UILabel*)aLabel maxSize:(int)maxSize minSize:(int)minSize lblWidth: (float)lblWidth lblHeight: (float)lblHeight {
// use font from provided label so we don't lose color, style, etc
UIFont *font = aLabel.font;
// start with maxSize and keep reducing until it doesn't clip
for(int i = maxSize; i >= minSize; i--) {
font = [font fontWithSize:i];
CGSize constraintSize = CGSizeMake(lblWidth, MAXFLOAT);
// NSString* string = [aLabel.text stringByAppendingString:@"..."];
//
// Created by Roland Kakonyi on 2018. 01. 29.
// Based on https://github.com/edekhayser/Tweeting-in-Swift
//
import Foundation
/**Arithmetic Mean
:param: array The array that the arithmetic mean will be found for.
@rolandkakonyi
rolandkakonyi / openUrlInSafariWebViewDelegate.m
Last active November 26, 2015 10:42
Open URLs from UIWebView in Safari instead of replacing the current content
//Add this to the UIWebView's delegate
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
//Check the navigation type to determine it is user click on a link
if (inType == UIWebViewNavigationTypeLinkClicked) {
//Open the URL with the system's browser (Safari)
[[UIApplication sharedApplication] openURL:[inRequest URL]];
//Prevent webview to load the target of the link
return NO;
}
//In all the other cases load the resources
// ==UserScript==
// @name ESCImageToIMG
// @description A brief description of your script
// @author Roland.K
// @include http://*api.sports-cube.com/*
// @version 1.0
function decorate(){
var images = $('span.type-string').filter(function( index ) {
return $($(this).siblings("span.property")[0]).text() == "self" && /\/images\/?/i.test($(this).text())