Skip to content

Instantly share code, notes, and snippets.

View anyweez's full-sized avatar
🔨
Building Subsalt

Luke Segars anyweez

🔨
Building Subsalt
View GitHub Profile
import pyarrow
import pyarrow.parquet as pq
import sys
if len(sys.argv) != 2:
print("Usage: python nan-checklist.py <parquet_file_path>")
sys.exit(1)
filename = sys.argv[1]
@anyweez
anyweez / subsalt.read.py
Created September 30, 2022 00:27
Reading Subsalt data into CSV
# Optional, but useful libraries
import psycopg2, pandas
# Connect to Subsalt and run a query
SUBSALT_USERNAME='{YOUR_EMAIL_ADDR}'
SUBSALT_PASSWORD='{YOUR_PASSWORD}'
conn = psycopg2.connect(
host='connect.subsalt.io',
dbname='subsalt',
@anyweez
anyweez / gist:7ee86345c663e313e91c7842f3ffb70c
Created May 15, 2022 20:25
Calcite: cannot translate call CURRENT_SCHEMA
Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Error while preparing plan [LogicalProject(CURRENT_SCHEMA=[CURRENT_SCHEMA])
LogicalValues(tuples=[[{ 0 }]])
]
at org.apache.calcite.util.Util.throwAsRuntime(Util.java:948)
at org.apache.calcite.tools.RelRunners.run(RelRunners.java:56)
at com.getsubsalt.dbfe.sql.SqlQueryRunner.execute(SqlQueryRunner.java:184)
at com.getsubsalt.dbfe.LocalQueryDev.main(LocalQueryDev.java:46)
Caused by: java.sql.SQLException: Error while preparing plan [LogicalProject(CURRENT_SCHEMA=[CURRENT_SCHEMA])
LogicalValues(tuples=[[{ 0 }]])
]

Game items

Data comes from here. Definitely possible to get more but I haven't had a reason to yet.

  • id : Game ID from ANet. Same value that shows up in the URL on the trading post website we use (example; this item's ID is 24349). Note that some items have the same name but are actually > 1 item in the database. This is how ANet does it so I didn't mess with it.
  • name : Name that shows up in the game
  • icon : Yup
  • is_market_transaction : Ignore for now; I added this and will prob remove it. Not currently meaningful whatsoever.

Market listing records

Data comes from here. I'm deleting records that are more than 30 days old to keep the database size down.

// This isn't exactly the code you're going to need; just a directional example.
fetch('https://randomuser.me/api/')
.then(resp => resp.json()) // arrow function! parses json response
.then(response => {
console.log(response.results[0].gender);
});
module.exports = {
users: [
{"id":1,"username":"hjuza0","name":"Hamlen Juza","avatar":"https://robohash.org/blanditiisexercitationemquaerat.png?size=150x150&set=set1","email":"[email protected]","university":"Pomor State University","job":"Engineer IV","company":"Stark, Feil and Bode","skills":["DMVPN","HDX","Rhino 3D"],"phone":"7-(397)813-7803","address":{"street_num":"78226","street_name":"Ryan","city":"Kamennogorsk","state_or_province":null,"postal_code":"188950","country":"Russia"}},
{"id":2,"username":"dodda1","name":"Dee Odda","avatar":"https://robohash.org/iurequiaet.bmp?size=150x150&set=set1","email":"[email protected]","university":"Chongqing Education College","job":null,"company":null,"skills":["Petrochemical","Omnet++","Spanish"],"phone":"86-(826)796-6920","address":{"street_num":"3446","street_name":"Onsgard","city":"Zhujiang","state_or_province":null,"postal_code":null,"country":"China"}},
{"id":3,"username":"ctimmes2","name":"Carleen Timmes","avatar":"https://robohash.org/oditipsanostru
// DOM elements
const searchBox = document.querySelector('#movie-search'); // search box
const searchBtn = document.querySelector('#go-btn'); // search button
const resultsBox = document.querySelector('ul'); // search results
// When the search button is clicked, run this function.
searchBtn.addEventListener('click', function () {
const searchText = searchBox.value;
searchFor(searchText);

Code style is extremely important for readability, but also very opinion-based. It's a good idea to install a linter once you're comfortable with Javascript so you can start improving consistency and readability. A linter is a tool that checks your code for common issues (like forgetting let in a for loop, cough cough) and styling inconsistencies (forgetting indentation).

Eslint is the most popular linter for Javascript. We'll walk you through installing it below.

Install eslint

You only need to do this once because we're installing it globally.

npm install --global eslint eslint-config-airbnb-base eslint-plugin-import@latest

We're installing Airbnb's custom rules, which are one of the top three most popular code 'standards'. I like them because they give justifications for WHY they use each of their rules on their github page.

@anyweez
anyweez / users.json
Created August 15, 2017 13:31
User data for Mustache daily project
{
"users": [
{
"id": 1,
"username": "hjuza0",
"name": "Hamlen Juza",
"avatar": "https://robohash.org/blanditiisexercitationemquaerat.png?size=150x150&set=set1",
"email": "[email protected]",
"university": "Pomor State University",
"job": "Engineer IV",

Install party: links and commands

You may already have some of this installed from the prework or everyday life; you can skip it if so. For links, click them and install the application on that page. For commands (block text), open Terminal and run them. Note that some will require you to type the password you use to log in to your computer.

  1. Google Chrome: amazing browser for development

  2. Atom: text editor for writing code

  3. Homebrew: easy software installation on MacOS