Ennis and Jack, the dogs, the horses and mules, a thousand ewes and their lambs flowed up the trail like dirty water through the timber and out above the tree line into the great flowery meadows and the coursing, endless wind.
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
state | change_funding | change_tuition | net_hike | unaccountable_hike | |
---|---|---|---|---|---|
Colorado | -510 | 4425 | 4935 | 3915 | |
California | 250 | 3983 | 3733 | 3733 | |
Virginia | -1218 | 4587 | 5805 | 3369 | |
New Hampshire | -1342 | 4686 | 6028 | 3344 | |
Hawaii | 1532 | 4716 | 3184 | 3184 | |
Vermont | -755 | 3711 | 4466 | 2956 | |
Rhode Island | -881 | 3756 | 4637 | 2875 | |
Oregon | -693 | 3334 | 4027 | 2641 | |
Massachusetts | -1117 | 3524 | 4641 | 2407 |
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
// compress a string by counting its repeating characters | |
def compress(a: String): String = a.foldLeft("") { (acc, l) => | |
acc.lastOption match { | |
case Some(c) => | |
if (c == l) => { | |
acc.slice(acc.lastIndexOf(l) - 1, acc.lastIndexOf(l)).headOption match { | |
case Some(d) => c match { | |
case l => if (Character.isDigit(d)) { | |
s"${acc.slice(0, acc.lastIndexOf(l) - 1)}${Character.digit(d, 10) + 1}" :+ l // add 1 to repeating characters we have seen | |
} else { |
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 scala.util.Random | |
import cats.data.State | |
object Deck { | |
sealed trait Rank | |
case object Two extends Rank | |
case object Three extends Rank | |
case object Four extends Rank | |
case object Five extends Rank |
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
<?php | |
$servername = "localhost"; | |
$username = "username"; | |
$password = "password"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password); | |
// Check connection |
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 functools | |
# our goal is to use the format feature of strings to render an array of integers, our encoded message, as a string | |
## remember character encodings? | |
# let's load up a fake one | |
# not a real one, not ascii; a fakeskii | |
encoding_file = open('zyx-fakeskii', 'r') |
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
# nnfs.io | |
import numpy as np | |
# a single array of inputs, for a layer of 3 neurons | |
inputs = [1, 2, 3, 2.5] | |
weights = [[0.2, 0.8, -0.5, 1], [0.5, -0.91, 0.26, -0.5], [-0.26, -0.27, 0.17, 0.87]] # 3 neurons | |
biases = [2, 3, 0.5] # and their bias |
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
const http = require('./http'); | |
const API_URL = 'http://localhost:3001'; | |
const API_CURRENT_VERSION = 'v0'; | |
const CURRENT_API_URL = `${API_URL}/api/${API_CURRENT_VERSION}`; | |
const API = { | |
entities: { | |
all: () => http.get({ | |
url: `${CURRENT_API_URL}/entities` |
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
// three ways of expressing registration and sending confirmation e-mail in scala | |
(R.register _) | |
.andThen(_ | |
.map(C.withConfirmable) | |
.map(_ >>= { confirmable => OptionT.liftF(C.sendConfirmationInstructions(confirmable)) }) | |
) | |
.andThen(_ >>= { _ => Ok() }) | |
.apply(form) |
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 cats.data.OptionT | |
import cats.implicits._ | |
/* | |
* in my domain, the confirmation algebra provides Confirmable, | |
* which is parameterized over the type of id of the thing, probably | |
* a user, to be confirmed, and the type of the confirmation token | |
*/ | |
type C = Confirmable[UUID, SecureRandomId] |