Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Marvelley craigmarvelley

View GitHub Profile
View typhoon-example.m
@implementation ExampleAssembly
- (MyModel *)model {
return [TyphoonDefinition withClass:[MyModel class]
configuration:^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(initWithDependency:)
parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self exampleDependency]];
View objection-example.m
JSObjectionInjector *injector = [JSObjection createInjector];
[injector bindBlock:^(JSObjectionInjector *context) {
MyModel *model = [[MyModel alloc] initWithDependency:context.getObject([Dependency class])];
return model;
} toClass:[MyModel class]];
id myModel = [injector getObject:[MyModel class]];
View blindside-example.m
@implementation MyViewController
+ (BSInitializer *)bsInitializer {
return [BSInitializer initializerWithClass:self
selector:@selector(initWithApi:)
argumentKeys:@"myApi", nil];
}
- (instancetype)initWithApi:(MyApi *)myApi {
...
View AppDelegateAfter.m
#import "AppDelegate.h"
#import "AppCoordinator.h"
@interface AppDelegate ()
@property (strong, nonatomic) AppCoordinator *coordinator;
@end
@implementation AppDelegate
View AppDelegateBefore.m
#import "AppDelegate.h"
@interface AppDelegate ()
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (strong, nonatomic) GCDWebServer *webServer;
@end
@implementation AppDelegate
@craigmarvelley
craigmarvelley / UISplitViewControllerDelegateService.m
Created Sep 27, 2014
Managing separation and collapsing of the new UISplitViewController in iOS 8
View UISplitViewControllerDelegateService.m
#import "UISplitViewControllerDelegateService.h"
#import "NoteViewController.h"
@interface UISplitViewControllerDelegateService () <UISplitViewControllerDelegate>
@end
@implementation UISplitViewControllerDelegateService
- (id)initWithSplitViewController:(UISplitViewController *)controller {
@craigmarvelley
craigmarvelley / launch_instances_role.yml
Created May 23, 2014
Launch and provision EC2 instances in one go
View launch_instances_role.yml
---
- name: Launch new instances
local_action:
module: ec2
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
region: "{{ ec2_region }}"
keypair: "{{ ec2_keypair }}"
group: "{{ ec2_group }}"
View internet.java
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import javax.swing.event.*;
public class Internet extends JFrame
{
final JDesktopPane theDesktop;
View EntityHiddenType.php
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
View index.js
$.ajax('login', {
success: function (response) {
var csrf = $('<div/>').append(response).find('input[name="_csrf_token"]').val();
if (!csrf) {
throw 'Failed to parse CSRF value';
}
$.ajax('login_check', {
type: "POST",
You can’t perform that action at this time.