Skip to content

Instantly share code, notes, and snippets.

View romyilano's full-sized avatar
😎
improving

Romy romyilano

😎
improving
View GitHub Profile
@romyilano
romyilano / info.plist
Created March 2, 2016 16:29 — forked from mlynch/info.plist
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
import UIKit
struct Article {
var title: String
var body: String
var date: NSDate
var saved: Bool
var thumbnail: NSURL
}
//
// RecipePageRenderer.swift
// (c) 2014 Nate Cook, licensed under the MIT License
//
import UIKit
import AVFoundation
/// Units for printing content insets
let POINTS_PER_INCH: CGFloat = 72
@romyilano
romyilano / MMTableViewWithParallaxHeader.m
Created October 29, 2015 16:21 — forked from manmal/MMTableViewWithParallaxHeader.m
Forwards hit testing on a UITableView to certain views which are behind the tableview (siblings of UITableView). Quite hacky :/ If you know a better way, please tweet @manuelmaly
@interface MMTableViewWithParallaxHeader : UITableView
@property (strong, nonatomic) NSArray *forwardTouchesOnTransparentCellToViews;
@end
@implementation MMTableViewWithParallaxHeader
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([self pointInside:point withEvent:event]) {
@romyilano
romyilano / HackerrankObjectiveCBoilerplate.m
Last active September 22, 2015 03:04 — forked from orkoden/HackerrankObjectiveCBoilerplate.m
Hackerrank.com Boilerplate template for reading from STDIN and writing to STDOUT for Objective-C
#import <Foundation/Foundation.h>
@interface HRSTDIOReadWriter : NSObject
@end
@implementation HRSTDIOReadWriter
+(NSString*) readFromSTDIN
{
NSFileHandle *kbd = [NSFileHandle fileHandleWithStandardInput];
@romyilano
romyilano / components_separated_by_string.cpp
Last active September 16, 2015 01:53 — forked from microtherion/components_separated_by_string.cpp
Implement C++ equivalent of ObjC componentsSeparatedByString:
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
template <typename String, typename OutputIt>
void components_separated_by_string(const String & string, const String & separator, OutputIt out)
{
typename String::size_type comp_start=0, comp_end;
while ((comp_end = string.find(separator, comp_start)) != String::npos) {
-(NSArray *)arrayWithStringPermutations:(NSString *)myString{
NSInteger stringLength = [myString length];
if (stringLength < 2) {
return [NSArray arrayWithObject:myString];
}
else{
NSString *head = [myString substringFromIndex:1];
NSString *newBase = [myString substringToIndex:1];
NSArray *permutations = [self arrayWithStringPermutations:newBase];
NSMutableArray *permutationsArray = [NSMutableArray array];
@romyilano
romyilano / gist:6519c574a1786c482b86
Last active September 9, 2015 23:33 — forked from paullewis/gist:1981455
Quicksort in JavaScript
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
@romyilano
romyilano / gist:a20c97e17fc4a3149e6e
Last active September 8, 2015 08:04 — forked from paullewis/gist:1982121
Mergesort in JavaScript
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
@romyilano
romyilano / sketch-plugins.md
Last active September 4, 2015 18:42 — forked from bomberstudios/sketch-plugins.md
A list of Sketch plugins hosted at GitHub, in no particular order.