Skip to content

Instantly share code, notes, and snippets.

//
// AdaptiveLabel.swift
// Coop
//
// Created by Jonah Burke on 1/17/19.
// Copyright © 2019 Jonah Burke. All rights reserved.
//
import UIKit
//
// NibBackedView.swift
// Coop
//
// Created by Jonah Burke on 1/8/19.
// Copyright © 2019 Jonah Burke. All rights reserved.
//
import UIKit
<html>
<head>
<meta charset="utf-8">
<title>Is n prime?</title>
<style>
body {
margin-top: 250px;
font-family: 'San Francisco', Helvetica, sans-serif;
font-size: 64px;
text-align: center;
#!/usr/bin/env ruby
class Hanoi
# @return [Integer]
attr_reader :rods
# @return [Integer]
attr_reader :discs
#!/bin/bash
# find with `diskutil list`
DEVICE=/dev/disk2
NAME=name
sudo port install dvdbackup
sudo port install cdrtools
dvdbackup -i $DEVICE -n $NAME -Mvp
require 'uri'
require 'base64'
require 'openssl'
require 'time'
require 'net/http'
require 'base64'
require 'nokogiri'
module AmazonProductAdvertising
10 RANDOMIZE
20 PRINT"GOSUB RELAY RANDOMIZER"
30 INPUT"HOW MANY RUNNERS";N
40 IF N < 1 THEN PRINT "COME ON": GOTO 20
50 DIM R$(N - 1)
60 FOR I = 0 TO N - 1
70 PRINT "NAME OF RUNNER";I + 1;
80 INPUT R$(I)
90 NEXT I
100 FOR I = 0 TO N - 1
@jonahb
jonahb / codesign.sh
Created May 17, 2014 00:41
Command-line iOS code signing
# Generate the key pair
openssl genrsa -out jonah.key 2048
# Generate the certificate signing request (CSR). Apple ignores the subject, so we leave it blank:
openssl req -new -subj / -key jonah.key -out jonah.csr
# Now submit the CSR to the Apple Developer site. It will give you a certificate in DER format. We need to bundle this certificate with the key pair before we can add it to the keychain where Xcode can access it. Assume the certificate has been named jonah.cer. First convert it from DER to PEM:
openssl x509 -inform der -in jonah.cer -out jonah.pem
# Then package the key pair and certificate into a single PKCS #12 file. You’ll have to type an “export password.”
#import <CoreGraphics/CoreGraphics.h>
@interface GraphicsNode(Protected)
- (void)requestDrawGraphics;
- (void)drawGraphics:(CGContextRef)context;
@end
class ActiveRecord::Relation
# Returns no more than n records, chosen at random
#
# @param [Integer] n
# @return [ActiveRecord::Base, nil]
# When n == 1
# @return [Array]
# When n > 1
#