Skip to content

Instantly share code, notes, and snippets.

View claraj's full-sized avatar

Clara claraj

  • Minneapolis College
  • Minneapolis, MN
View GitHub Profile
package week7_first_classes;
import java.util.Date;
/**
* Created by clara on 10/23/19.
*/
public class DateObjects {
public static void main(String[] args) {
<!DOCTYPE html>
<html>
<p>Here's a random yes or no: <span id="yes-no"></span></p>
<script>
let yesNo = document.querySelector('#yes-no')
console.log('Script starting!')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
proxy: 'http://127.0.0.1:3000'
}
})
import kotlin.random.Random
/****** Number types, Int and Double ******/
val classCredits = 6 // A constant Int value
val classWeeks: Int = 17 // Can include type
val classHours = 2.5 // A constant Double value
val textbookPrice: Double = 35.99 // constant Double, can include type
import requests # alt+enter or hover over error to import
from pprint import pprint # optional use pprint to print the response
def get_random_activity():
url = 'https://www.boredapi.com/api/activity'
# get response and convert json response to python dictionary
response = requests.get(url).json()
# pprint(response) # make sure you import pprint at the top of the file
# extract the activity text
activity = response['activity'] # spelling must match dictionary keys
import requests
kitten_picture_url = 'https://placekitten.com/600/400'
response = requests.get(kitten_picture_url)
with open('kitten.jpg', 'wb') as file:
for chunk in response.iter_content():
file.write(chunk)
@claraj
claraj / rps.py
Created February 16, 2021 17:59
Python enum for Rock-Paper-Scissors choices
from enum import Enum
import random
class Play(Enum):
ROCK = 1
PAPER = 2
SCISSORS = 3
def __str__(self):
return self.name.title() # so when printing an enum, it prints 'Rock' instead of 'ROCK'
  1. Create Git repo, add code, push code
  2. Enable GitHub pages.
  3. In Vue code, create new file vue.config.js with this contents. This file will be in the base directory of your project, same place as package.json. Change name-of-your-repo to the name of your GitHub repo
module.exports = {
    publicPath: process.env.NODE_ENV === 'production'
      ? '/name-of-your-repo/'
      : '/',
      outputDir: "docs"
@claraj
claraj / base_counts.py
Last active March 31, 2021 13:47
Python bioinformations 101
dna3 = 'ACGACGGATACGCGGGAGCTATTCATCTGTGTTGAGAAACACCGGAGAACTTATTGGTCTGTCAAGATTGCGACTGTGGTATAGCTCACCCGGTCGCGGCTTTCTAGT' \
'TAGTGGCCAGCTCCCGTGTATTTGGAAGCTGAGAGAAGGACCCCTGTGGTTCGAATCAGCTCACGAGCGCTGGCACACCGCAATCAGCCGGCTAATAAAATTCGTACG' \
'GACTGCCCCACACAAGAAGACGGTAAATTTATCAACACTATAGTTGCTATACACCAGGAGCGAGCGTAAATTTGTAGCGGTCAGATTAACTTGCTGGGAACGAACCAT' \
'TGTCGCCCTCTGCAGCAAGTTAGTTGGCATCATTGGTACTGCCCTTCACTGGTAGCAGCTCCCCCTGTAATATATCCGTGGCCACTATTCAAGGGCTCAAATAGGCGA' \
'CCCAGAGACCATTATAGGCGGTACAGCGCTGGTAGGTTTGCCTGGGCAGATATCGTTAGCCCCTTCTGCGCGCTATAAGATAGCGAAGGATAATTCTGCGGGACCA' \
'TGGTCGTCTCCTAACCTCAGGGTGGGATTCCTGGCAGGTGGACCGGGCGCGCATCGAGAGCATTCGGGGTTCCTACCAGCCAGGGAAATCGGGTCGACCACTAGGCAA' \
'TGAGCGGCTCACACCGATTTTCTTAAGAGACGTAACAAAGCCCGCATTAACGGCTGGAGTGAATCACCGTACGACTACCTAAGCCTCATTGGGATCCACTGTAAACCC' \
'CTTCGCCGGTGTTGGGTGTCCGCAACGCCTCTGCTTTTTGCGTACAGTCGGCGTGGTGGAGTCCGCGGCCATACTGGCGGTTGGTTTGTAGAACAGTGTAACGACGTG' \
'TGTCACTGCCCCCCGTAGCTTCTATTGCCCTGTTTGGGAGGTTCTATAGGGGTTACAG
@claraj
claraj / basics.py
Created August 9, 2020 13:51
Python basics
# Python basics
# No need to specify type of variables
zebras = 4
school = 'MCTC'
GPA = 3.4
languages = ['Python', 'JavaScript', 'Swift']
mobile_development_languages = { 'iOS': 'Swift', 'Android': 'Java' }
# For loops - repeat once for every item in an iterable