Skip to content

Instantly share code, notes, and snippets.

@QuinnStephens
QuinnStephens / paul_clifford.rb
Last active August 29, 2015 14:27
Grabs random paragraphs from Edward Butler-Lytton's 1830 novel PAUL CLIFFORD, source of the famous "It was a dark and stormy night." Use it if you're bored of lorem ipsum.
require 'nokogiri'
require 'open-uri'
require 'clipboard'
page = Nokogiri::HTML(open('https://www.gutenberg.org/files/7735/7735-h/7735-h.htm'))
count = ARGV[0] ? ARGV[0].to_i : 1
output = ''
count.times do |i|
output << page.css('p').to_a.sample.text.strip.split.join(' ') << (i < count - 1 ? "\n\n" : "\n")
end
@QuinnStephens
QuinnStephens / .profile
Created August 25, 2015 20:55
Function for quick unique Android emulator screenshots
function acap {
NOW=`date +%s`
adb shell /system/bin/screencap -p /sdcard/screenshot_"${NOW}".png
adb pull /sdcard/screenshot_"${NOW}".png ~/Downloads/screenshot_"${NOW}".png
}
class MenuSolver
def initialize(weights, limit)
@weights = weights
@limit = limit
self.iterate(0, [])
end
def iterate (total, order)
@weights.each do |w|
weights = []
weights.append 215
weights.append 275
weights.append 335
weights.append 355
weights.append 420
weights.append 580
limit = 1505
export ENV=development
# Table XI
export TXI_DEVELOPER_USER="[txi email]"
export TXI_DEVELOPER_PASSWORD="[txi apple password]"
export TXI_FABRIC_API_TOKEN='[fabric api token]'
export TXI_FABRIC_BUILD_SECRET='fabric build secret]'
# Commands
alias oops="git reset HEAD~"
@adjectives = [
'ancient', 'magic', 'mystic', 'curious', 'secret', 'hidden', 'forgotten',
'forsaken', 'forbidden', 'exhumed', 'cursed', 'unseen', 'banished',
'frozen', 'crystal', 'diamond', 'ruby', 'emerald', 'sapphire', 'silver',
'golden', 'amber', 'gilded', 'dark', 'darkened', 'darkening', 'moonlit',
'sunlit', 'abyssal', 'deep', 'sacred', 'exalted', 'hunted', 'cold',
'ashen', 'abandoned', 'shining', 'glowing', 'illuminated', 'misty',
'desecrated', 'red', 'blue', 'green', 'violet', 'purple',
'indigo', 'orange', 'cerulean', 'jade', 'rose', 'scarlet', 'crimson',
'winged', 'burning', 'burned', 'drowned', 'sunken', 'shattered',

Keybase proof

I hereby claim:

  • I am quinnstephens on github.
  • I am quinnstephens (https://keybase.io/quinnstephens) on keybase.
  • I have a public key ASCvyLVCQzLMIrbb-7Qi1AcdttOzBnf1XDGw_WJ2zj3EDgo

To claim this, I am signing this object:

The following files show receipt data and Apple's responses from its /verifyReceipt endpoint when enacting a simulated scenario using an iTunes sandbox user.

Real-world scenario we seek to represent

  1. A user purchases an auto-renewing monthly subscription.
  2. The receipt (a.k.a. originalReceipt) from this purchase is posted to /verifyReceipt and the response recorded.
  3. The subscription auto-renews 5 times and then the user turns off auto-renewal, causing the subscription to lapse.
  4. originalReceipt is posted to /verifyReceipt and the response recorded.
  5. Over 60 days pass.
  6. The user purchases an auto-renewing monthly subscription.
  7. The receipt (a.k.a. newReceipt) from the re-subscription is posted to /verifyReceipt and the response recorded.
@interface Environment: NSObject
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *facebookKey;
-(id)initWithData:(NSDictionary *)data;
@end
@QuinnStephens
QuinnStephens / phaser-animation-loop-capture.html
Last active March 8, 2022 16:06
Capture looping animation from Phaser
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.min.js"></script>
</head>
<body>
<script>