Skip to content

Instantly share code, notes, and snippets.

View fcy's full-sized avatar

Felipe Cypriano fcy

View GitHub Profile
<!-- This is what you need to do to avoid conflict when using
JasperReport or xercesImpl in a mavenized Grails project -->
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>${jasperreports.version}</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
apply plugin: 'groovy'
sourceCompatibility = 1.5
version = '0.1-SNAPSHOT'
repositories {
mavenRepo(urls: 'http://repository.codehaus.org/')
mavenCentral()
}
# 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 <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
#
@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;
# 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 / 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
@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 / 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