Skip to content

Instantly share code, notes, and snippets.

View JayWalker512's full-sized avatar

Brandon Foltz JayWalker512

View GitHub Profile
const root = 'https://api.spacetraders.io';
// utils
const timeout = (seconds) => new Promise(resolve => setTimeout(resolve, seconds * 1000));
const sleeper = (seconds) => (x) => new Promise(resolve => setTimeout(() => resolve(x), seconds * 1000));
const userName = () => `user-${new Date().getTime()}-${Math.random()}`;
const querySeparator = (path) => path.indexOf('?') === -1 ? '?' : '&';
const get = (path) => fetch(`${root}${path}`).then(x => x.json()).then(saveState).then(saveArchive).then(sleeper(1));
const post = (path, body) => fetch(`${root}${path}`, postOptions(body)).then(x => x.json()).then(saveState).then(saveArchive).then(sleeper(1));
const put = (path, body) => fetch(`${root}${path}`, putOptions(body)).then(x => x.json()).then(saveState).then(saveArchive).then(sleeper(1));
@santi-pdp
santi-pdp / Hello PyTorch.ipynb
Created January 24, 2018 17:53
Toy example in pytorch for binary classification
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbinna
mbinna / effective_modern_cmake.md
Last active December 16, 2024 16:40
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/