Skip to content

Instantly share code, notes, and snippets.

View texas2010's full-sized avatar

Tex texas2010

View GitHub Profile
const getJSON = async (url) => {
try {
const response = await fetch(url)
return await response.json()
} catch (error) {
throw new Error('Unable to get data: ', error)
}
}
export { getJSON as default }
@texas2010
texas2010 / ajaxFunction.js
Last active August 27, 2017 17:42
my own ajax function.
var ajaxFunction = function (object) {
var problemMessage = function (message) {
console.error(message);
};
if (!Array.isArray(object) && typeof object == "object") {
object.method = object.method || "GET"; // Default Value for method
object.type = object.type || "text"; // Default Value for type
if(!object.url) { // Check URL
delete object.url;
problemMessage("'url:' is required in the ajaxFunction().");
@texas2010
texas2010 / breakpoints.css
Last active September 3, 2020 03:30
Responsive breakpoints
/* Extra small devices (portrait phones, less than 576px) */
/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {