Skip to content

Instantly share code, notes, and snippets.

View nara-l's full-sized avatar

Lawrence Nara nara-l

View GitHub Profile
@jonathantneal
jonathantneal / README.md
Last active November 5, 2023 05:42
Practical ARIA Tabs: Creating fully accessible tabs

Practical ARIA Tabs

This is a small guide to marking up fully accessible tabs. Consider using PostHTML ARIA Tabs as a practical solution.

The Rules

  1. Add tablist role to the <ul> to indicate it contains tabs.
  2. Add presentation role to each <li> to bypass its list item state.
  3. Add tab role to each <a> to incidate it is an actual tab.
  4. Add href and aria-controls to each <a> to reference its tab panel.
@scrapehero
scrapehero / yelp_search.py
Last active April 7, 2022 18:31
Python 3 code to extract business listings from Yelp.com
from lxml import html
import unicodecsv as csv
import requests
from time import sleep
import re
import argparse
import json
def parse(url):
@autumnwoodberry
autumnwoodberry / user.js
Last active March 24, 2022 06:49
vuex + vuelidate
import Vue from 'vue'
import { validationMixin } from 'vuelidate'
import { required, minLength } from 'vuelidate/lib/validators'
export default function (store) {
const validator = new Vue({
mixins: [
validationMixin
],
computed: {
@cb109
cb109 / breakpoint.js
Last active May 5, 2022 15:40
Vue Breakpoints Mixin (also available via npm: https://www.npmjs.com/package/vue-md-breakpoint)
// Now officially integrated into Vuetify:
//
// https://github.com/vuetifyjs/vuetify/blob/master/src/components/VApp/mixins/app-breakpoint.js
// https://github.com/vuetifyjs/vuetify/blob/master/src/components/VApp/mixins/app-breakpoint.spec.js
/**
* A Vue mixin to get the current width/height and the associated breakpoint.
*
* Useful to e.g. adapt the user interface from inside a Vue component
* as opposed to using CSS classes. The breakpoint pixel values and
@vkarpov15
vkarpov15 / promise2.js
Created April 5, 2018 13:57
Write Your Own Node.js Promise Library from Scratch, Part 2
class MyPromise {
constructor(executor) {
if (typeof executor !== 'function') {
throw new Error('Executor must be a function');
}
// Internal state. `$state` is the state of the promise, and `$chained` is
// an array of the functions we need to call once this promise is settled.
this.$state = 'PENDING';
this.$chained = [];
@ramazankanbur
ramazankanbur / test_api.js
Last active October 23, 2019 16:59
sample
describe('Api test', () => {
var apiUrl = 'http://localhost:4000';
var token = '';
var app = undefined;
//Testin her çalıştırılmasında çalışacak kısım
beforeEach(done => {
User.remove({ name: { $ne: 'TestUser' } }, err => {
if (err) {
console.error('User collection”ı temizlenirken hata oluştu');
let UserModel = require('../model/user');
let userManager = require('../dataManager/userManager');
let jwt = require('jsonwebtoken');
let coreConfig = require('../config/projectConfig').coreConfig;
var userController = {
loginControl: (user) => {
var promise = userManager.getUserByNameAndPassword(user);
return promise.then((result) => {
if (result.success) {
@evlymn
evlymn / firestore.service.ts
Last active August 29, 2023 19:29
Firestore Basics, Modular Firebase 9
import { Injectable } from '@angular/core';
import { Firestore, collectionData, collection, QueryConstraint } from '@angular/fire/firestore';
import { addDoc, CollectionReference, deleteDoc, doc, getDoc, query, setDoc, updateDoc } from '@firebase/firestore';
import { enableIndexedDbPersistence } from 'firebase/firestore';
@Injectable({
providedIn: 'root'
})
export class FirestoreService {