Skip to content

Instantly share code, notes, and snippets.

View rolandkakonyi's full-sized avatar

Roland Kákonyi rolandkakonyi

View GitHub Profile
// ==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())
@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
//
// 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 / 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:@"..."];
#!/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,
import Foundation
extension CALayer {
public func animate() -> CALayerAnimate {
return CALayerAnimate(layer: self)
}
}
public class CALayerAnimate {
import Foundation
protocol DefaultRawValueDecodable: RawRepresentable, Decodable {
static var defaultValue: Self { get }
}
extension DefaultRawValueDecodable where RawValue: Decodable {
init(from decoder: Decoder) throws {
@rolandkakonyi
rolandkakonyi / PSPDFGenerics.h
Created February 1, 2020 14:12 — forked from steipete/PSPDFGenerics.h
Override copy and mutableCopy on Objective-C collection classes to pass along both the collection type and the generic info. This is a header-only "library". MIT licensed. Craving for more? foreach: https://gist.github.com/steipete/7e3c69b985165dc23c5ec169b857ff42 even more: https://pspdfkit.com/blog/2016/swifty-objective-c/ - ships in https://p…
//
// PSPDFGenerics.h
// PSPDFFoundation
//
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com.
// Try it today using our free PDF Viewer app: https://pdfviewer.io/
//
// This file is MIT licensed.
/**
//
// PSPDFFastEnumeration.h
// PSPDFFoundation
//
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com.
// Try it today using our free PDF Viewer app: https://pdfviewer.io/
//
// This file is MIT licensed.
@protocol PSPDFFastEnumeration <NSFastEnumeration>