Skip to content

Instantly share code, notes, and snippets.

View fcy's full-sized avatar

Felipe Cypriano fcy

View GitHub Profile
@fcy
fcy / XCTAssert+Dictionaries.swift
Created February 21, 2018 22:17
XCTAssert to easy assert heterogenous dictionaries are equal
/// Makes testings dictionaries berable in Swift. It correctly tests heterogenous dictionaries
///
/// E.g.:
/// let expected: [String: Any] = ["p": true]
/// let actual = doSomething() // returns [String: Any]
/// XCTAssertEqual(actual, expected)
///
public func XCTAssertEqual<K, V>(_ expression1: @autoclosure () throws -> [K: V], _ expression2: @autoclosure () throws -> [K: V], _ message: @autoclosure () -> String? = nil, file: StaticString = #file, line: UInt = #line) {
do {
let lhs = try expression1() as NSDictionary
@fcy
fcy / CrashlyticsAdapter.h
Created June 24, 2016 23:05
Thumbtack's Crashlytics Adapter
#import <Foundation/Foundation.h>
/* How To Enable CrashlyticsAdapter
*
* # On the App Target
*
* Initialize Crashlytics as usual and pass the real Crashlytics instance to the adapter:
*
* [Fabric with:@[[Crashlytics class]]];
* [CrashlyticsAdapter with:[Crashlytics sharedInstance]];
@fcy
fcy / gist:92f7cd21de37129b6d3d
Created September 5, 2014 22:49
Hide Pods from GitHub's PR Diffs
$('#files_bucket .file').each(function() {
var fileDiff = $(this).children('.data, .image')
var fileNameSpan = $(this).find('.info > .js-selectable-text').first()
var fileName = fileNameSpan.attr('title')
var filter = /Pods/
if (filter.test(fileName)) {
fileDiff.hide()
}
});
@fcy
fcy / alfred_urban_dictionary.py
Created March 25, 2013 21:14
My first Python script. It integrates Urban Dictionary with the new Alfred 2 Workflow. Download the bundle here: https://www.dropbox.com/s/edrab4lyzi5gorj/Urban%20Dictionary.alfredworkflow
import urllib2
from HTMLParser import HTMLParser
import xml.etree.ElementTree as ET
class UrbanDictionaryHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.is_parsing_entries = False
self.definitions = []
self.is_word_open = False
# AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIViewController *rootController = [[UIStoryBoard storyboardWithName:@"MainStoryBoard" bundle:nil] instantiateInitialViewController];
PPRevealSideViewController *revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:rootController];
self.window.rootViewController = _revealSideViewController;
[window makeKeyAndVisible];
return YES;
@fcy
fcy / gist:5051802
Created February 27, 2013 21:15
Super ugly code. Discussion: https://alpha.app.net/fcy/post/3286152
@implementation DatabaseConnection
static DatabaseConnection *connection;
+ (DatabaseConnection *)connection;
{
return connection;
}
+ (void)setConnection:(DatabaseConnection *)newConnection;
@fcy
fcy / fix-git-svn.sh
Created July 23, 2012 22:07
Fix git-svn on Mountain Lion
#! /bin/bash
# Fix git-svn on Mountain Lion
# Author: Felipe Cypriano <[email protected]
# Based on Vitor Quinn blog post:
# http://victorquinn.com/blog/2012/02/19/fix-git-svn-in-mountain-lion/
# If you do not have xcode-select pointing to the right Xcode installation
# put the right path in the line bellow and uncoment it
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# encoding: utf-8
class OperationsController < ApplicationController
respond_to :json
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
def show
operation = Operation.find(params[:id])
respond_with operation
end
@fcy
fcy / objectivec.def
Created December 2, 2010 14:01
Syntax highlight definition for Atlassian Fisheye and Crucible. Save the file in <FISHEYE_INST>/syntax and update <FISHEYE_INST>/syntax/filemap to objective-c file extensions.
# Objective-C Syntax Highliht for Atlassian Fisheye and Crucible
# Based on Atlassian's C syntax highlight
# Author: Felipe Cypriano <[email protected]>
# Copyright 2010 Felipe Cypriano
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
apply plugin: 'groovy'
sourceCompatibility = 1.5
version = '0.1-SNAPSHOT'
repositories {
mavenRepo(urls: 'http://repository.codehaus.org/')
mavenCentral()
}