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 com.company;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by clara on 4/18/17. Example Date manipulations.
*/
public class DateOperations {
public static void main(String[] args) {
import os
import psycopg2
from urllib.parse import urlparse
#https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-python
p_url = urlparse(os.environ["DATABASE_URL"])
url = urlparse(p_url)
@claraj
claraj / Heroku.md
Last active March 14, 2018 01:09
Heroku on lab PC

Open a Windows command prompt

Type

heroku login

Enter username and password

@claraj
claraj / gist:3b2b95a62c5ba6860c03b5c737c214ab
Created April 12, 2017 21:34
Custom JSON encoder for Flask
from flask import Flask
from flask import render_template
from flask import request
from flask import jsonify
import json
# This class tells Python how to turn a Delivery object into a JSON string.
# This class could encode various types of objects - use isinstance to check what type of thing it is, and return the appropriate JSON
# https://docs.python.org/3/library/json.html
package com.company;
import java.util.HashMap;
import java.util.Scanner;
public class HashMapSnow {
static Scanner stringScanner = new Scanner(System.in);
static Scanner numberScanner = new Scanner(System.in);

Install the latest MongoDB Community Server.

Verify you can run mongod and mongo from your command prompt or terminal

(If you can't, Google "configure path variable" for your platform. You need to add the mongo\bin directory to your path.)

Decide where you want your data directory to live. Assuming you are on a lab PC, let's say your StarID is ab1234cd so you'd like it to be at C:\Users\ab1234cd\data\db.

You'll need to create that data\db directory.

/** LakeRunMain.java */
package Lakes;
/* Will create RunningLaps objects and store them in a list
*
* Will ask the user for input
*
* Will print out data, like the fastest time for each lake
package com.company;
/**
* Created by admin on 3/9/17.
*/
public class Stringbuilder2 {
public static void main(String[] args) {
int length = 100000;
int c = 0;
package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
LinkedList<Integer> linkedList = new LinkedList<Integer>();
ArrayList<Integer> arrayList = new ArrayList<Integer>();
@claraj
claraj / state_abbr.txt
Created January 17, 2017 04:31
US states and their 2-letter abbreviations; separated with tabs
Alabama AL
Alaska AK
Arizona AZ
Arkansas AR
California CA
Colorado CO
Connecticut CT
Delaware DE
Florida FL
Georgia GA