Skip to content

Instantly share code, notes, and snippets.

View anthonyalvarez's full-sized avatar
🏠
Working from home as a remote web coder

Anthony E. Alvarez anthonyalvarez

🏠
Working from home as a remote web coder
View GitHub Profile
@anthonyalvarez
anthonyalvarez / index.html
Last active August 29, 2015 14:27 — forked from anonymous/index.html
Anthony Alvarez // source http://jsbin.com/xanuri
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Anthony Alvarez</title>
</head>
<body>
@anthonyalvarez
anthonyalvarez / .gitignore
Last active August 25, 2018 21:36 — forked from octocat/.gitignore
Some common .gitignore configurations
# Local files
###################
# package-lock.json
# ignore all files in the build/ directory
# Dependency directories
###################
node_modules/
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Source https://help.github.com/articles/about-codeowners/
# This is a comment.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @global-owner1 @global-owner2
@anthonyalvarez
anthonyalvarez / gist:d9c0fbf46efd21ecd55907484ff7d6e4
Created July 31, 2018 22:10
Using Visual Studio Code as the default Git editor
# https://www.mking.net/blog/using-vscode-as-the-default-git-editor
git config --global core.editor "code --new-window --wait"
git config --global core.editor "code --wait"
@anthonyalvarez
anthonyalvarez / gist:04e07dc5f0bf552cfe54b0c739f3d742
Last active July 31, 2018 22:45
8.1 Customizing Git - Git Configuration with commit.template
type: subject
body
footer
# ========= INSTRUCTIONS FOR USE ============4950
#
# The Type
# The type is contained within the title
@anthonyalvarez
anthonyalvarez / IndexedDB-snippets.md
Last active November 29, 2021 14:09
Indexed DB Code Snippets idb.js

IndexedDB Snippets

Opening a Database

/**
 * @param: 2 - Database name, version
 * @returns: Constructor function
 * @description: Opening a Database
 */
@anthonyalvarez
anthonyalvarez / IndexedDB-with-Promises.md
Last active November 22, 2018 13:43
Indexed DB with Promises

IndexedDB Promised

This is a tiny library that mirrors IndexedDB, but replaces the weird IDBRequest objects with promises, plus a couple of other small changes.

Installation

If you're using Rollup/Webpack or similar:

npm install idb
@anthonyalvarez
anthonyalvarez / service-worker.md
Last active September 28, 2018 17:08
Service Worker

Service Workers

Feature Probe

with error handling.

This is the entry point that starts entire process of an offline web experience. Browser has to support serviceWorker object.

if ('serviceWorker' in navigator) {
@anthonyalvarez
anthonyalvarez / Fetch-API-and-Promises.md
Last active October 14, 2018 21:44
Fetch API and Promises

Fetch API and Promises

Semi-colons are placed only inside code blocks and at end of the last promise in the chain.

.then and .catch are similiar to UNIX file pipes process.

Response object methods

  • .text
  • .json
@anthonyalvarez
anthonyalvarez / JavaScript-Promises.md
Last active November 21, 2018 14:32
JavaScript ES6 Promise Methods

JavaScript Promises

What is a promise?

The core idea behind promises is that a promise represents the result of an asynchronous operation. A promise is in one of three different states:

• pending - The initial state of a promise.
• fulfilled - The state of a promise representing a successful operation.
• rejected - The state of a promise representing a failed operation.