Skip to content

Instantly share code, notes, and snippets.

Avatar

Felipe Cypriano fcy

  • San Francisco
View GitHub Profile
@fcy
fcy / XCTAssert+Dictionaries.swift
Created Feb 21, 2018
XCTAssert to easy assert heterogenous dictionaries are equal
View XCTAssert+Dictionaries.swift
/// 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 Jun 24, 2016
Thumbtack's Crashlytics Adapter
View CrashlyticsAdapter.h
#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 Sep 5, 2014
Hide Pods from GitHub's PR Diffs
View gist:92f7cd21de37129b6d3d
$('#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 Mar 25, 2013
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
View alfred_urban_dictionary.py
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
View gist:5189583
# 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;
View gist:5051802
@implementation DatabaseConnection
static DatabaseConnection *connection;
+ (DatabaseConnection *)connection;
{
return connection;
}
+ (void)setConnection:(DatabaseConnection *)newConnection;
@fcy
fcy / fix-git-svn.sh
Created Jul 23, 2012
Fix git-svn on Mountain Lion
View fix-git-svn.sh
#! /bin/bash
# Fix git-svn on Mountain Lion
# Author: Felipe Cypriano <felipe@cypriano.me≥
# 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
View refactory.rb
# 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 Dec 2, 2010
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.
View objectivec.def
# Objective-C Syntax Highliht for Atlassian Fisheye and Crucible
# Based on Atlassian's C syntax highlight
# Author: Felipe Cypriano <fmcypriano@gmail.com>
# 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
#
View build_intellij_sync.gradle
apply plugin: 'groovy'
sourceCompatibility = 1.5
version = '0.1-SNAPSHOT'
repositories {
mavenRepo(urls: 'http://repository.codehaus.org/')
mavenCentral()
}
You can’t perform that action at this time.