Skip to content

Instantly share code, notes, and snippets.

const useFetch = endpoint => {
const defaultHeader = {
Accept: "application/json",
"Content-Type": "application/json"
};
const customFetch = (
url,
method = "GET",
body = false,
headers = defaultHeader
@djg07
djg07 / ASL
Created September 14, 2019 01:46
{
"Comment": "A simple AWS Step Functions state machine that automates a call center support session.",
"StartAt": "ProcessTransaction",
"States": {
"ProcessTransaction": {
"Type" : "Choice",
"Choices": [
{
"Variable": "$.TransactionType",
"StringEquals": "PURCHASE",
@himanshk96
himanshk96 / ALS_implementation.py
Created June 23, 2019 19:15
Recommendation using ALS for implicit data. Code for Medium Blog
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 23 22:20:58 2019
@author: himansh
"""
#import libraries
import sys
import pandas as pd
import numpy as np
@easternnl
easternnl / setup for installing Virtual User Generator - Analysis and Fiddler.cmd
Last active October 8, 2021 06:57
Setup for installing Virtual User Generator - Analysis and Fiddler
@rem Create by Erik van Oost for version PC/LR 12.55
@if not exist C:\temp mkdir C:\temp
@echo %~f0
@set scriptpath=%~f0\..\
@echo Extracting setup files with 7Zip
%scriptpath%7z.exe x %scriptpath%SetupVugen.exe -oC:\temp\SetupVugen -y
%scriptpath%7z.exe x %scriptpath%SetupAnalysis.exe -oC:\temp\SetupAnalysis -y
@echo Installing prerequisites for Vugen
@straker
straker / README.md
Last active February 17, 2025 04:31
Basic Breakout HTML and JavaScript Game

Basic Breakout HTML and JavaScript Game

This is a basic implementation of the Atari Breakout game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Lives
  • The player should have 3 chances to remove all the bricks. Display how many lives the player currently has using context.fillText(). Remove a life when the ball goes below the screen
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>FormData Objects</title>
</head>
@Paratron
Paratron / storageHooks.js
Created February 14, 2019 12:24
Enables you to use hooks for localStorage and sessionStorage that even redraw all components when their respective values change.
import React from "react";
let lsBus = {};
let ssBus = {};
/**
* Redraw all components that have a hook to localStorage with the given key.
* @param {string} key
* @param {*} newValue
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Putting User Input into JS Objects</title>
<style>
.formBox{
padding: 0.5rem 2rem;
@adrianhajdin
adrianhajdin / index.js
Created January 26, 2019 21:09
HTML Template
module.exports = ({ name, price1, price2, receiptId }) => {
const today = new Date();
return `
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PDF Result Template</title>
<style>
.invoice-box {