Skip to content

Instantly share code, notes, and snippets.

View andrespch's full-sized avatar

Andrés Portillo andrespch

View GitHub Profile
{
"com.apptentive#EnjoymentDialog#no" = (
{
configuration = {
"ask_for_email" = 1;
"email_required" = 0;
"enable_message_center" = 1;
"thank_you_body" = "<null>";
};
criteria = {
@andrespch
andrespch / gist:2182cb91976d7b476955
Created June 4, 2015 10:48
Response from List Provas (note the repeated tests)
{
"qtdTotalDeProvas":4,
"provas":[
{
"id":37,
"dateCreated":"2015/05/28 04:16:55",
"lastUpdated":"2015/05/28 04:16:55",
"turmas":[
{
"id":17,
{
"id":45,
"usuario":"Aluno Three",
"entregue":true,
"entregueEm":"2015-06-05T07:19:44Z",
"questoesRespondidas":[
{
"idQuestao":97,
"peso":1.0,
"questaoRespondida":"<p>&ldquo;Iniciar a frase com pronome &aacute;tono s&oacute; &eacute; l&iacute;cito na conversa&ccedil;&atilde;o familiar, despreocupada, ou na l&iacute;ngua escrita quando se deseja reproduzir a fala dos personagens (...)&rdquo;.&nbsp;Comparando a explica&ccedil;&atilde;o dada pelos autores sobre essa regra, pode-se afirmar que ambos:<\u002fp>\r\n<p>&nbsp;<\u002fp>",
{
"qtdTotalDeProvas":7,
"provas":[
{
"id":42,
"dateCreated":"2015/06/04 02:49:05",
"lastUpdated":"2015/06/04 02:49:05",
"turmas":[
{
"id":17,
{
"id":81,
"usuario":"Aluno One",
"entregue":true,
"entregueEm":"2015-06-16T23:06:38Z",
"questoesRespondidas":[
{
"idQuestao":123,
"peso":1.0,
"questaoRespondida":"<p>Leia o texto e veja a imagem antes de responder:<\u002fp>",
{
"qtdTotalDeProvas":2,
"provas":[
{
"id":82,
"dateCreated":"2015/06/16 06:53:47",
"lastUpdated":"2015/06/16 06:53:47",
"turmas":[
{
"id":16,
- (instancetype)add:(NSString *)num {
int sLength = (int)MIN(num.length, self.num.length);
int length1 = (int)self.num.length;
int length2 = (int)num.length;
int lengthDiff = abs(length1 - length2);
BOOL larger = num.length > self.num.length;
NSNumber *toAdd;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
@andrespch
andrespch / PSPDFUIKitMainThreadGuard.m
Created February 3, 2016 17:25 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
import Cocoa
struct MyNumber {
private var string:String!
var lenght:Int {
get {
return string.characters.count
}
@andrespch
andrespch / UINavigationControllerExtension.swift
Created April 19, 2017 14:57
NavigationController Extension to push/pop with a completion closure
extension UINavigationController {
private func doAfterAnimatingTransition(animated: Bool, completion: @escaping (() -> Void)) {
if let coordinator = transitionCoordinator, animated {
coordinator.animate(alongsideTransition: nil, completion: { _ in
completion()
})
} else {
DispatchQueue.main.async {
completion()
}