Skip to content

Instantly share code, notes, and snippets.

View sp2013hem's full-sized avatar

Hemanth Anumolu sp2013hem

View GitHub Profile
@sp2013hem
sp2013hem / recipes.json
Last active January 19, 2020 11:53
252 Recipes Dataset
This file has been truncated, but you can view the full file.
[{"t":"30 minutes","id":"Mushroom-risotto-352492","r":5,"n":"Mushroom Risotto","ser":6,"nut":[{"n":"FAT_KCAL","v":80,"u":"kcal"},{"n":"Fatty acids, total polyunsaturated","v":0.24,"u":"grams"},{"n":"Campesterol","v":0,"u":"grams"},{"n":"Folate, DFE","v":298.07,"u":"mcg_DFE"},{"n":"Folate, food","v":0,"u":"grams"},{"n":"Manganese, Mn","v":0,"u":"grams"},{"n":"Vitamin E (alpha-tocopherol)","v":0,"u":"grams"},{"n":"Fatty acids, total monounsaturated","v":4.79,"u":"grams"},{"n":"Vitamin C, total ascorbic acid","v":0.01,"u":"grams"},{"n":"Carotene, beta","v":0,"u":"grams"},{"n":"Vitamin B-12","v":0,"u":"grams"},{"n":"Folate, total","v":0,"u":"grams"},{"n":"Glucose (dextrose)","v":0.34,"u":"grams"},{"n":"Cholesterol","v":0.02,"u":"grams"},{"n":"Methionine","v":0.07,"u":"grams"},{"n":"Leucine","v":0.93,"u":"grams"},{"n":"Folic acid","v":0,"u":"grams"},{"n":"Threonine","v":0.07,"u":"grams"},{"n":"Niacin","v":0.01,"u":"grams"},{"n":"Aspartic acid","v":0.87,"u":"grams"},{"n":"Tocopherol, gamma","v":0,"u":"grams"},{"n":
@sp2013hem
sp2013hem / override-addEventListener.html
Created October 2, 2019 07:11 — forked from pmuellr/override-addEventListener.html
test to see what we can do when we override addEventListener
<!--
======================================================================
Example trying to show hooking addEventListener to see if we can
capture error state for errors that occur in the handler.
Basically, we can capture that an error occurred, and get the
error message, and the event and object that was fired that
caused code to run that caused the error. But no stack trace
or line information.
@sp2013hem
sp2013hem / locale-language.js
Created May 28, 2019 07:50
JavaScript snippet to detect users' locale language preference
// this function is is taken from http://angular-translate.github.io/ and refactored so that it will be independent of angular
function getLocaleLanguage() {
var nav = window.navigator,
browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'],
i,
language,
len,
shortLanguage = null;
// support for HTML 5.1 "navigator.languages"

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.