Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Marvelley craigmarvelley

View GitHub Profile
@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 }}"
@craigmarvelley
craigmarvelley / Web.config
Created May 8, 2011
Silex IIS Web.config
View Web.config
<?xml version="1.0"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
@craigmarvelley
craigmarvelley / gist:1339292
Created Nov 4, 2011
Titanium 1.7.5 and underscore.string.js
View gist:1339292
// (Starting line 446)
// CommonJS module is defined
if (typeof module !== 'undefined' && module.exports) {
// Export module
module.exports = _s;
// Added: Support Titanium's CommonJS implementation)
} else if (typeof exports !== 'undefined' && exports) {
exports._s = _s;
@craigmarvelley
craigmarvelley / gist:2047834
Created Mar 16, 2012
Symfony & PHPCR composer.json
View gist:2047834
{
"name": "symfony/framework-standard-edition",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.2",
"symfony/symfony": "2.1.*",
"doctrine/orm": "2.2.*",
"doctrine/doctrine-bundle": "dev-master",
@craigmarvelley
craigmarvelley / es.sh
Created Nov 2, 2012 — forked from rajraj/es.sh
Install ElasticSearch on CentOS 6
View es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.11.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
View index.js
$(document).ajaxError(function (e, xhr, settings, exception) {
var STATUS_CODE_UNAUTHORIZED = 401,
STATUS_CODE_FORBIDDEN = 403;
// If we don't have a valid session, show a login form
if (xhr.status === STATUS_CODE_UNAUTHORIZED || xhr.status === STATUS_CODE_FORBIDDEN) {
showLoginForm();
}
});
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;
@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 {
View AppDelegateBefore.m
#import "AppDelegate.h"
@interface AppDelegate ()
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (strong, nonatomic) GCDWebServer *webServer;
@end
@implementation AppDelegate
View AppDelegateAfter.m
#import "AppDelegate.h"
#import "AppCoordinator.h"
@interface AppDelegate ()
@property (strong, nonatomic) AppCoordinator *coordinator;
@end
@implementation AppDelegate