Skip to content

Instantly share code, notes, and snippets.

@chriseidhof
chriseidhof / Futamura.lhs
Last active April 17, 2017 18:44
Futamura projections
In this article, we we will look at the first three Futamura projections.
> module Futamura where
Suppose we have a program datatype, which takes input to output. This could be
any kind of executable program:§
> data Program i o = Program i o
It is accompanied by an `exec` function which executes the program, and given an
@chriseidhof
chriseidhof / gist:5687433
Created May 31, 2013 19:36
A method that you can use in your test cases so you'll have a managed object context around.
- (NSManagedObjectContext*)managedObjectContextForTesting {
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"YourModelName" withExtension:@"momd"];
NSManagedObjectModel* model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
NSPersistentStoreCoordinator* coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
[coordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:NULL];
NSManagedObjectContext* managedObjectContext= [[NSManagedObjectContext alloc] init];
managedObjectContext.persistentStoreCoordinator = coordinator;
return managedObjectContext;
}
@chriseidhof
chriseidhof / classes.sh
Last active December 18, 2015 03:48
All classes in iOS Execute this in e.g. "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks" or /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks
#!/bin/sh
All classes in iOS
Execute this in e.g. "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks"
(find . -name "*.h" -type f -exec grep "@interface" {} \;) | sed -E 's/^.*\@interface[ \t]+([a-zA-Z0-9]+).*/\1/' | sort | uniq
#import <Foundation/Foundation.h>
@class CBEModel;
@protocol THTableControllerDelegate
- (void)configureCell:(id)cell item:(id)item;
@end

Hi, I'll write a post about NSSpain on my blog when it finishes, but until then I want to go completing this gist with all the available stuff about the event (slides, videos, etc.).

If you are a speaker or want to add some material, don't hesitate to send me a pull request or ping me on Twitter :)

TV & another media

  • RTVE - Informativo Telerioja | Video.
...
CGPoint location = [recognizer locationInView:view];
self.interactionController = [UIPercentDrivenInteractiveTransition new];
if (location.x < CGRectGetMidX(view.bounds) && self.navigationController.viewControllers.count > 1) { // left half
[self.navigationController popViewControllerAnimated:YES];
} else {
[self.navigationController pushViewController:myViewController animated:YES];
}
...
//
// GPUImageAnimator.h
// NavigationTransitionTest
//
// Created by Chris Eidhof on 9/28/13.
// Copyright (c) 2013 Chris Eidhof. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Animator.h"
#include "clang/Driver/Options.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
@chriseidhof
chriseidhof / deckset.py
Created January 31, 2014 11:45
Deckset Sublime Plugin
# Go to Tools > New Plugin, type deckset.py and press 'Save'
# Then paste in the code below.
#
# It currently only works when you have a single file open, but it could easily be improved (pull requests very welcome)
import sublime, sublime_plugin, subprocess, os
class GoToSlideCommand(sublime_plugin.TextCommand):
def run(self, edit):
pos = self.view.sel()[0].begin()
@chriseidhof
chriseidhof / pechakucha.sh
Last active January 19, 2017 11:56
Advance Deckset slides every 20 seconds
#/bin/bash
# Works from Deckset 1.2 upwards. Make sure you have a document opened.
#
# If you're using the Trial version change "Deckset" to "Deckset Trial"
osascript -e 'repeat' -e 'tell application "Deckset" to tell document 1 to set slideIndex to slideIndex + 1' -e 'delay 20' -e 'end repeat'