Skip to content

Instantly share code, notes, and snippets.

@jloescher
jloescher / metadata.xml
Created December 30, 2023 04:34
Stellar MLS Schema
<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="com.mlsgrid.metadata">
<EntityType Name="Property">
<Key>
<PropertyRef Name="ListingId"/>
</Key>
<Property Name="AccessibilityFeatures" Type="Collection(Edm.String)" MaxLength="1024">
<Annotation Term="RESO.OData.Metadata.LookupName" String="AccessibilityFeatures"/>
@jloescher
jloescher / whale_talk.js
Created February 7, 2021 02:00
Convert a phrase to whale talk using function, loops, and arrays.
let input = 'Anh yeu em, yeu hon!';
const vowels = ['a', 'e', 'i', 'o', 'u'];
resultsArray = [];
function whaleTalk(phrase) {
const lowerCasePhrase = phrase.toLowerCase();
for (let l = 0; l < lowerCasePhrase.length; l++) {
// console.log(lowerCasePhrase[l]);
for (let v = 0; v < vowels.length; v++) {
if (vowels[v] === lowerCasePhrase[l]) { // whales only use vowels.
@jloescher
jloescher / tip_calculator.js
Created February 6, 2021 21:11
Calculate a tip based on quality of service.
let tipCalculator = (quality, total) => {
switch (quality) {
case 'bad':
return total * 0.05;
break;
case 'ok':
return total * 0.15;
break;
case 'good':
return total * 0.20;
@jloescher
jloescher / check_if_value_is_even.js
Created February 6, 2021 21:10
Check if the value of a number is even.
function isEven(value) {
if (value%2 == 0)
return true;
else
return false;
}
console.log(isEven(2))
@jloescher
jloescher / rock_paper_scissors.js
Created February 6, 2021 02:56
Simple CLI rock, paper, scissors game.
const userInput = 'Bomb'.toLowerCase();
function getComputerChoice() {
let randomInt = Math.floor(Math.random() * 3);
switch (randomInt) {
case 0:
return 'rock';
break;
case 1:
return 'paper';
@jloescher
jloescher / temperature_conversion.js
Created February 5, 2021 22:58
Temperature unit conversion JS
// Holds the constant value of the kelvin tempature
const kelvin = 0;
// Convert kelvin to celsius
const celsius = kelvin - 273;
// Convert celsius to fahrenheit
let fahrenheit = celsius * (9/5) + 32;
// Rount the value from the quation to the nearest whole number.
fahrenheit = Math.floor(fahrenheit);
console.log(`The temperature is ${fahrenheit} degrees Fahrenheit.`);
// Convert celsius to newtons
@jloescher
jloescher / twitter.js
Created August 29, 2020 22:15
Twitter API Start
require('dotenv').config();
const Twitter = require('twitter');
let client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
bearer_token: process.env.TWITTER_BEARER_TOKEN,
});
let params = {
@jloescher
jloescher / ZSH-Config.md
Last active May 13, 2020 14:00
ZSH Configuration info.

How I choose where to put a setting

  • if it is needed by a command run non-interactively: .zshenv
  • if it should be updated on each new shell: .zshenv
  • if it runs a command which may take some time to complete: .zprofile
  • if it is related to interactive usage: .zshrc
  • if it is a command to be run when the shell is fully setup: .zlogin
  • if it releases a resource acquired at login: .zlogout
package main
import "fmt"
func main() {
for i := 33; i <= 122; i++ {
fmt.Printf("%v in Hex is %#x and in Ascii is: %#U\n", i, i, i)
}
}
@jloescher
jloescher / wordgames.py
Created August 26, 2016 19:13
Learning to program Part 2- Functions, Lists, and Strings
import random
def getRandomWord():
words = ["pizza", "cheese", "apples"]
word = words[random.randint(0, len(words)-1)]
return word
def showWord(word):
for character in word:
print(character, " ", end='')