Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Downloads and imports: allCountries.zip alternateNames.zip userTags.zip admin1CodesASCII.txt admin2Codes.txt countryInfo.txt featureCodes_en.txt iso-languagecodes.txt timeZones.txt"
# MODIFIED TO USE CURL INSTEAD OF WGET
#===============================================================================
#
# FILE: getgeo.sh
#
@rw3iss
rw3iss / install_tmux_osx_no_brew.sh
Last active October 20, 2020 16:04 — forked from tomasbasham/install_tmux_osx_no_brew
Install tmux on OSX without homebrew
# Create a directory
mkdir ~/tmux-install
cd ~/tmux-install
# Get the files
curl -OL https://www.openssl.org/source/openssl-1.1.1g.tar.gz
curl -OL https://github.com/tmux/tmux/releases/download/3.1b/tmux-3.1b.tar.gz
curl -OL https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
# Extract them
In computer science, we describe "backend" and "frontend", and these explicitly mean:
Frontend: This is the app that you see, in your browser, specifically. Frontend can also generally mean any client that you interact with, think "Front-facing for the public, so it could mean a desktop app as well, or a phone app. A client is any consuming piece of code (ie. A a part of your backend code, for example, could be considered a "client" that is using another library... it's a client from the libraries perspective... just trying to show the vagueness of the term client).
Backend: The server environment (whatever the front-end talks to at a remote location). The server receives requests from the clients (can be any frontend, web, mobile, desktop, etc), and the backend server fulfills those requests, which means talking to a database, making other remote requests to APIs, gathering the data and returning it in the response, usually in the form of JSON (javascript data notation), if it's a REST API, which most back
@rw3iss
rw3iss / HttpClient.ts
Last active May 30, 2021 17:19
HttpClient base class - a fetch wrapper for service classes to extend, with Basic authentication token using cookies, no dependencies
import Request from './Request';
//import ErrorService from 'lib/services/ErrorService';
// Todo: change body + headers arguments to opts: {} object.
export default class HttpClient {
// shortcuts
public get<T>(url) {
return this.request(url, 'GET');
}
@rw3iss
rw3iss / notify.ts
Last active October 20, 2020 16:08
toastr Notifications
import toastr from 'toastr';
export function notify(message, type?, timeout?) {
// todo, set options elsewhere/on init ?
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
@rw3iss
rw3iss / getGithubStars.ts
Last active February 10, 2021 13:12
Load Github Stars for Repository
let url = 'https://api.github.com/repos/rw3iss/schemedream';
function loadGithubStarCount(url) {
const self = this;
fetch(url)
.then(r => r.json())
.then(r => {
self.setState({
githubStars: (r as any).stargazers_count
})
@rw3iss
rw3iss / runAndParseBenchmarkResults.js
Last active February 10, 2021 13:12
Batch run apache benchmark tests (node.js)
/*
* Requirements:
* npm install ab-result
*
* How to use:
* Tune parameters/url below, and then run with:
* node run.js
*
* Note: This script is part of larger testing library/benchmark at;
* https://github.com/rw3iss/modern-web-framework-benchmarks
@rw3iss
rw3iss / addDejaDupIgnoreFiles.sh
Created January 25, 2021 11:40
Add .deja-dup-ignore file to all subdirectories matching a pattern
# This will only add it to the first instance/depth of the matching ignoreFolder (ie. it won't add it to the sub-dependencies of any node_modules folder
startPath=/home/rw3iss/Sites
ignoreFolder=node_modules
find $startPath -mindepth 1 -maxdepth 5 -name "$ignoreFolder" -type d -not -regex ".*$ignoreFolder.*$ignoreFolder.*" | while read fname; do
echo "" > "$fname/.deja-dup-ignore"
echo "$fname/.deja-dup-ignore created."
done
@rw3iss
rw3iss / FPSCounter.tsx
Last active January 28, 2021 17:31
FPS Counter Component
// Borrowed / modified from: https://github.com/bornbit/fps/
import { h, Component } from 'preact';
import FPS from './fps';
export default class FPSCounter extends Component {
componentDidMount() {
// container id, and update interval ms
this.fps = new FPS("#fps-container", 250);
@rw3iss
rw3iss / .bash_aliases
Last active February 7, 2021 23:18
.bash_aliases
# Path shortcuts:
alias h='cd ~'
alias ~='cd ~'
alias ..='cd ..'
alias d='cd ~/Downloads'
alias s='cd ~/Sites'
# Servers: