Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@petebarber
petebarber / ViewController.swift
Created January 3, 2018 21:05
View Controller from the Resizable project
import UIKit
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate
{
@IBOutlet weak var picker: UIPickerView!
@IBOutlet weak var redRectView: UIView!
var viewToUse: UIView?
var window: UIView?
var pinch: UIPinchGestureRecognizer?
var rotate: UIRotationGestureRecognizer?
'use strict';
const assert = require("assert");
const sinon = require("sinon");
const aws = require("aws-sdk");
const spawn = require("child_process").spawn;
aws.config.update({region: "us-east-1" });
describe("AWSLambdaToTest", function()
{
'use strict';
const AWS = require("aws-sdk");
const errors = require("./Errors.js");
const findUserByEmailAddress = function(emailAddress)
{
AWS.config.dynamodb = { endpoint: "http://localhost:8000" };
const docClient = new AWS.DynamoDB.DocumentClient();
'use strict';
const assert = require("assert");
const sinon = require("sinon");
const aws = require("aws-sdk");
const spawn = require("child_process").spawn;
aws.config.update({region: "us-east-1" });
describe("awsLambdaToTest", function()
{
enum WhenToReturn
{
case After0
case After1
case After2
}
func deferTest(whenToReturn: WhenToReturn, shouldBranch: Bool)
{
print("Defer Test - whenToReturn:\(whenToReturn), shouldBranch:\(shouldBranch)")
@petebarber
petebarber / private.xml
Last active January 2, 2016 07:29
Custom key mappings for KeyRemap4MacBook to enable PC development on OS X
<?xml version="1.0"?>
<root>
<appdef>
<appname>INTELLIJ</appname>
<equal>com.jetbrains.intellij</equal>
</appdef>
<replacementdef>
<replacementname>MY_IGNORE_APPS</replacementname>
<replacementvalue>VIRTUALMACHINE, TERMINAL, REMOTEDESKTOPCONNECTION, VNC, INTELLIJ</replacementvalue>
@petebarber
petebarber / gist:6236315
Created August 14, 2013 22:30
Capturing lvalue references in C++11 lambdas sample code
#include <iostream>
#include <typeinfo>
void ref2ref()
{
std::cout << "ref2ref\n";
int foo = 7;
int& rfoo = foo;
int& rfoo1 = rfoo;
#include <iostream>
#include <vector>
#include <string>
class ISimpleBoundFunctorBase
{
public:
ISimpleBoundFunctorBase(const std::string& id)
: _id(id)
{
@petebarber
petebarber / grass.swift
Last active August 29, 2015 14:20
OSX/Cocoa command line program to create a bitmap, draw into it and save as a PNG. In this case it draws triangles that are used a basic grass asset
import Cocoa
private func saveAsPNGWithName(fileName: String, bitMap: NSBitmapImageRep) -> Bool
{
let props: [NSObject:AnyObject] = [:]
let imageData = bitMap.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: props)
return imageData!.writeToFile(fileName, atomically: false)
}