Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
@dylanerichards
dylanerichards / mta.js
Created March 9, 2023 21:20
MTA request
const https = require('https');
https.get(
"https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-ace",
{ headers: { "x-api-key": 'lYhbEN7wnL2iEftZVWfK68m5tcA6y3mn2KOjBxYi'}
},
(resp) => {
resp.on('data', (chunk) => {
console.log(chunk)
console.log("Receiving Data");
@dylanerichards
dylanerichards / sample-readme.md
Created July 28, 2022 15:47
A README for Regina

Rails URL Shortener

A simple API for shortening URLs.

Running the application

  1. Clone the repository
  2. cd into it and run the migrations (bundle exec rake db:migrate)
  3. Install the dependencies by running bundle
  4. Start the Rails server by running rails server in the project root
  5. Run the test suite by typing rspec
class CartProductsController < ApplicationController
def create
cart_products = current_user.cart.products
if cart_products.map(&:product_id).include?(params[:product_id])
cart_product = cart_products.select { |product| product.product_id == params[:product_id] }.first
cart_product.update(quantity: cart_product.quantity + 1)
cart_product.save
else
CartProduct.create(
hours_in_year = (24 * 7) * 52
seconds_in_minute = 60
minutes_in_hour = 60
hours_in_day = 24
seconds_in_day = seconds_in_minute * minutes_in_hour * hours_in_day
puts "There are #{seconds_in_day} seconds in a day"
Stylesheet Link:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
Javascript Link:
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
IFS=$'\n' ; for x in $(git shortlog -sne | cut -f2 -d$'\t' | sed -e 's/ <.*//' | sort | uniq); do echo $x; git log --since '2 weeks ago' --author="$x" -p | grep '^[+-][^+-]' | wc | cut -c1-8 ; done
@dylanerichards
dylanerichards / .tmux.conf
Created October 21, 2020 14:33
.tmux.conf
# Prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse scrolling
set-option -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont="Inconsolata"
set smartindent
ENV["SINATRA_ENV"] ||= "development"
require_relative './config/environment'
require 'sinatra/activerecord/rake'
require 'active_support/duration'
namespace :medicine do
task :send_reminders do
twilio_account_sid = "AC4bf52c17125e47be385b764e50474a64"
twilio_auth_token = "0231a729464dedc96dd783b0a39c9ba8"