Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Awad benawad

View GitHub Profile
View recipe.json
{
"cookbookLookup": [
{
"sectionId": "f04a8c56-e717-321c-8d8e-bacfe456cd10",
"cookbookId": "8a73c530-e1ec-3287-8e96-ad3a35367d39",
"sectionName": "Desserts",
"cookbookName": "Test Recipes"
}
],
"id": "bd9a25f2-051d-4033-b868-d9b7ac9f9abc",
View hashTable.js
function hashStringToInt(s, tableSize) {
let hash = 17;
for (let i = 0; i < s.length; i++) {
hash = (13 * hash * s.charCodeAt(i)) % tableSize;
}
return hash;
}
View coc-settings.json
{
"suggest.noselect": false,
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"typescript",
"typescriptreact",
"json",
"javascriptreact",
"typescript.tsx",
"graphql"
View init.vim
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
View pairprogramming.md
View TodoList.jsx
import React from "react";
import TodoForm from "./TodoForm";
import Todo from "./Todo";
/*
TodoMVC
1. add todo
2. display todos
3. cross off todo
4. show number of active todos
View stat_weights.json
{
"rogue": {
"daggers": {
"crit": 20.0,
"hit": 17.0,
"mainHandDps": 14.0,
"offHandDps": 7.0,
"mainHandAvgDmg": 6.8,
"offHandAvgDmg": 0.0,
"agility": 1.7,
View useForm.ts
import { useState } from "react";
export const useForm = <T>(initialValues: T) => {
const [values, setValues] = useState(initialValues);
return [
values,
(e: any) => {
setValues({
...values,
View useForm.js
export const useForm = initialValues => {
const [values, setValues] = useState(initialValues);
return [
values,
e => {
setValues({
...values,
[e.target.name]: e.target.value
});
View graphql-timing.js
app.use("/graphql", (req, res, next) => {
const startHrTime = process.hrtime();
res.on("finish", () => {
if (req.body && req.body.operationName) {
const elapsedHrTime = process.hrtime(startHrTime);
const elapsedTimeInMs =
elapsedHrTime[0] * 1000 + elapsedHrTime[1] / 1e6;
logger.info({
type: "timing",