Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
@johndpope
johndpope / Gemfile-0.39.rb
Created December 7, 2018 03:14 — forked from brennanMKE/Gemfile-0.39.rb
Gemfiles for CocoaPod Versions
source 'https://rubygems.org'
gem 'cocoapods', '~> 0.39.0'
#gem 'cocoapods', :git => 'https://github.com/CocoaPods/CocoaPods.git', :branch => '0.39-stable'
gem 'activesupport', '< 5'
#!/usr/bin/env python
# Based on https://www.openwall.com/lists/oss-security/2018/08/16/1
# untested CVE-2018-10933
import sys, paramiko
import logging
username = sys.argv[1]
hostname = sys.argv[2]
command = sys.argv[3]
@johndpope
johndpope / executionTimeInterval.swift
Created September 6, 2018 14:32 — forked from kristopherjohnson/executionTimeInterval.swift
Calculate execution time for a block of Swift code
import QuartzCore
func executionTimeInterval(block: () -> ()) -> CFTimeInterval {
let start = CACurrentMediaTime()
block();
let end = CACurrentMediaTime()
return end - start
}
@johndpope
johndpope / setup_aws_gpu.sh
Last active August 17, 2018 20:19 — forked from mlgill/setup_aws_gpu.sh
Setup AWS GPU instance - bump 9.2.148
#!/bin/bash
####################################################################################
## AWS GPU Instance Setup Script ##
## John Pope ##
## ##
## Gist location: https://gist.github.com/johndpope/ac3ae5f4e033d1ca6c94d3387e4dc309 ##
## Date updated: 2018/08/17 ##
####################################################################################
@johndpope
johndpope / cuda-setup.sh
Created August 14, 2018 19:03 — forked from cVeqT2vkiSX5kJVJxcVmz7rKHKbu9M9FNixoPNC/cuda-setup.sh
Setup script for Amazon EC2 GPU cracking with cudaHashcat
#!/bin/bash
#set -x
readonly progname=$(basename $0)
readonly ARGS="$@"
#see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
mydate=$(date +"%Y%m%d-%H%M")
S3BUCKET="camelinc-cracking"
###From an Ubuntu 16.04 Instance with 20GB of HD space
###Update Ubuntu
sudo apt-get update
sudo apt-get -y upgrade
###Download Nvidia Software
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
extension CGPoint : Hashable {
func distance(point: CGPoint) -> Float {
let dx = Float(x - point.x)
let dy = Float(y - point.y)
return sqrt((dx * dx) + (dy * dy))
}
public var hashValue: Int {
// iOS Swift Game Development Cookbook
// https://books.google.se/books?id=QQY_CQAAQBAJ&pg=PA304&lpg=PA304&dq=swift+CGpoint+hashvalue&source=bl&ots=1hp2Fph274&sig=LvT36RXAmNcr8Ethwrmpt1ynMjY&hl=sv&sa=X&ved=0CCoQ6AEwAWoVChMIu9mc4IrnxgIVxXxyCh3CSwSU#v=onepage&q=swift%20CGpoint%20hashvalue&f=false
return x.hashValue << 32 ^ y.hashValue
@johndpope
johndpope / google-ngrams_2grams-to-5grams_without-punctuation.txt
Created October 4, 2017 23:23 — forked from gagliardetto/google-ngrams_2grams-to-5grams_without-punctuation.txt
Calculate the uncompressed size of remote gzip files by downloading them, unzipping to stdin and counting bytes.
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-a_.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-aa.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ab.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ac.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ad.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ae.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-af.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ag.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ah.gz
https://storage.googleapis.com/books/ngrams/books/googlebooks-ita-all-2gram-20120701-ai.gz
@johndpope
johndpope / Dockerfile
Created September 28, 2017 15:27 — forked from ultimateprogramer/Dockerfile
Dockerfile to install supervisor over Ubuntu Image
FROM ubuntu:latest
MAINTAINER Ahmed Maawy
# Run updates
RUN apt-get update --fix-missing && apt-get install -y
# Install Curl
RUN apt-get install curl -y
# Install supervisor

Using GraphQL with the Apollo iOS client

Were you ever annoyed when working with a REST API because the endpoints didn't give you the data you needed for the views in your app? Getting the right information either required multiple server requests or you had to bug the backend developers to adjust the API? Worry no more, GraphQL and Apollo to the rescue! 🚀

GraphQL is a new API design paradigm that was open-sourced by Facebook in 2015. It introduces a new era for APIs by eliminating a lot of the ineffencies with today's de-facto standard REST. In contrast to REST, GraphQL APIs only expose a single endpoint and the consumer of the API can precisely specify what data they require with every request.

In this tutorial, you're going to build an iPhone app that helps users plan which iOS conferences they'd like to attend. You'll setup your own GraphQL server and interact with it from the app using the [Apollo iOS Client]