Skip to content

Instantly share code, notes, and snippets.

View casey-chow's full-sized avatar

Casey Chow casey-chow

View GitHub Profile
@casey-chow
casey-chow / README.md
Last active July 26, 2022 03:52
Prisma 4 Migration

This codemod can be used to migrate rejectOnNotFound usages to the new Prisma 4 findUniqueOrThrow and findFirstOrThrow methods.

@casey-chow
casey-chow / wait-for-subscription-with-trigger.ts
Last active November 24, 2020 19:08 — forked from blocka/wait-for-subscription.ts
waitForSubscription helper function for testing graphql subscriptions
/**
* Waits for a subscription after a trigger function is called. The trigger function is delayed to
* properly time the subscription return event.
*/
const waitForSubscription = async <TResult = any>(
subscription: DocumentNode,
trigger: () => Promise<void>
): Promise<ExecutionResult<TResult>> => {
const iterator = await subscribe<TResult>(
schema,
@casey-chow
casey-chow / docker-compose.yml
Created December 13, 2019 00:39
Directus with SSL and Google Cloud Storage (via Minio)
version: '2'
services:
directus:
image: directus/directus:v8.2.0-apache
environment:
# App
DIRECTUS_APP_ENV: "production"
DIRECTUS_APP_TIMEZONE: "America/Los_Angeles"

Keybase proof

I hereby claim:

  • I am casey-chow on github.
  • I am caseychow (https://keybase.io/caseychow) on keybase.
  • I have a public key ASAcYHgmOYDnJ0HpIBBysyRaQ90SLHhPbobCAv-IlNogcwo

To claim this, I am signing this object:

@casey-chow
casey-chow / Scraping Tutorial.ipynb
Last active April 29, 2017 20:05
Scraping Tutorial for Code@Night
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[cc22@davisson]~% curl 'localhost:33333/1879'
JDS 400/REL 400 HA C01 MW 11:00-12:20 Israel&#39;s Enslavement and Exodus from Egypt: Exodus 1-15 Baruch J. Schwartz Class of 1879 Hall 133
REL 326 HA C01 MW 1:30-2:50 Buddhist Literature: Interpreting the Lotus Sutra Jacqueline I. Stone Class of 1879 Hall 133
REL 337/NES 357 HA S01 W 1:30-4:20 Slavery and Gender in Islamic Societies Shaun E. Marmon Class of 1879 Hall 231
REL 393 HA S01 M 1:30-4:20 Science and Religion in America Brendan Pietsch Class of 1879 Hall 137
REL 524 S01 Th 3:00-4:20 Religion in the Americas Workshop Jessica Delgado Class of 1879 Hall 137
REL 533 S01 Th 1:30-4:20 Readings in Japanese Religions - Practices, Discourses, Representations Jacqueline I. Stone Class of 1879 Hall 249
var fs = require('fs');
http.createServer(function (req, res) {
fs.readFile('/path/to/json', function (err, data) {
var html = '<table>';
for (var elem in data) {
if (data.hasOwnProperty(elem)) {
html += '<tr><td>' + elem + '</td><td>' + data[elem] + '</td></tr>';
}
}
html += '</table>';
import java.util.Scanner;
class ArrayStuff {
public static void main(String args[]) {
}
public static void tenIntegerVariables() {
int[] ints = new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
long deadline = date.getTime() + 3000;
System.out.println(deadline);
System.out.println(Long.toString(date.getTime()));
while (date.getTime() < deadline) {
boolean enter = input.hasNextByte();
if (enter == true) {
misc.fast = true;
}
try {
Thread.sleep(5);
print "Enter numbers, separated by commas: "
numbers = gets.chomp.split(/,/)
#total = 0
numbers.each do |number|
number = number.to_f
total = total + number
end
average = total / numbers.length
puts "Average of numbers: #{average.round(2)}"