This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CoreGraphics/CoreGraphics.h> | |
@interface GraphicsNode(Protected) | |
- (void)requestDrawGraphics; | |
- (void)drawGraphics:(CGContextRef)context; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'base64' | |
require 'openssl' | |
require 'time' | |
require 'net/http' | |
require 'base64' | |
require 'nokogiri' | |
module AmazonProductAdvertising |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Hanoi | |
# @return [Integer] | |
attr_reader :rods | |
# @return [Integer] | |
attr_reader :discs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NibBackedView.swift | |
// Coop | |
// | |
// Created by Jonah Burke on 1/8/19. | |
// Copyright © 2019 Jonah Burke. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AdaptiveLabel.swift | |
// Coop | |
// | |
// Created by Jonah Burke on 1/17/19. | |
// Copyright © 2019 Jonah Burke. All rights reserved. | |
// | |
import UIKit |