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.util.HashMap;
import java.util.Scanner;
public class HashMapSnow {
static Scanner stringScanner = new Scanner(System.in);
static Scanner numberScanner = new Scanner(System.in);
@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
@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

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)
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) {
package com.company;
import org.joda.time.DateTime;
import org.joda.time.Days;
import java.util.Date;
/**
* Created by admin on 4/26/17.
*/
0. Add the \bin directory of the Java JDK folder to your Windows path. It will be something like C:\Program Files\java\jdk1.8.65\bin. Make sure you use the directory with 'jdk' in the name, not 'jre'.
Click Start
Type Advanced System Settings
In this window, click Environment Variables...
Find the entry for the PATH variable
Click Edit
At the end of the PATH variable, add a semi colon (;) and then the location of the Java jdk \bin directory on your computer.
Example: On my computer, it C:\Program Files\java\jdk1.8.65\bin. Replace with the actual directory on your computer.
MySQL, Git, and Maven from the command line: Windows version
0. MySQL server should be running. You should create the table(s) needed for the application - see MySQL setup information.
1. Fork the example repository and note the URL. In this example I'll use the DogDB repository at https://github.com/minneapolis-edu/DogSQL
2. Clone your repository to your own computer. Navigate to the directory you would like to create the project in and type the following, replacing the URL with your project's URL
git clone https://github.com/yourusername/DogSQL
//
const Clarifai = require('clarifai');
const app = new Clarifai.App({
apiKey : 'f0e78cd592a147b58a14e68d156ac5fc'
})
app.models.predict(Clarifai.GENERAL_MODEL, 'https://samples.clarifai.com/metro-north.jpg').then(
@claraj
claraj / Regex
Created September 4, 2017 20:45
Regular expressions in Java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
*/
public class REGEX {
public static void main(String[] args) {