Skip to content

Instantly share code, notes, and snippets.

View nmathira's full-sized avatar
😀

Niranjan Mathirajan nmathira

😀
  • University of Massachusetts Amherst' 27
  • Amherst, MA
View GitHub Profile
@nmathira
nmathira / vtcsformatter.xml
Created October 5, 2020 17:59
Code Formatter for WebCAT
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="19">
<profile kind="CodeFormatterProfile" name="vt-cs-style" version="19">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
@nmathira
nmathira / apirequests.py
Created June 9, 2021 22:21
Receiving data from an API, with and without verification
import requests
def get_dog_fact():
data = requests.get("https://some-random-api.ml/facts/dog")
if data.status_code == 200:
data = data.json()
return data["fact"]
else:
return f"Request Failed with status code: {data.status_code}"