Skip to content

Instantly share code, notes, and snippets.

View nmquebb's full-sized avatar

Nick Quebbeman nmquebb

  • Chicago, IL
View GitHub Profile
@nmquebb
nmquebb / rakefile.rb
Last active June 30, 2016 23:05
Install preferred plugins at the beginning of a Craft project.
# OCTO CRAFT
# Set plugins to install using craft-cli
# by toggling true or false per plugin.
#
# Instructions:
# brew tap rsanchez/homebrew-craft-cli
# brew install craft-cli
# rake octo:install
plugins = [
defmodule Providers.Gmail do
@moduledoc """
API access to Gmail services.
https://developers.google.com/gmail/api/guides/
"""
# """
# Base API endpoint for our requests
# """
@base_url "https://www.googleapis.com/gmail/v1"
defmodule Animals do
alias Animals.{Cat, Dog, Bear}
def get_module("cat"), do: Cat
def get_module("dog"), do: Dog
def get_module("bear"), do: Bear
def do_this(model),
do: apply(get_module(model.type), :validate_structure, [model])
let LISTENERS = {},
LISTENER_IDS = new Set(),
id = 0,
index = 0,
ids = [],
len = 0;
/**
* @name handleOnScroll
* Bind this function to scroll. Iterates over all the listeners
@nmquebb
nmquebb / site.js
Last active January 20, 2020 19:25
Simple Components
import { Slider } from "./components/Slider";
import { Modal } from "./components/Modal";
// Store all of the components in an object we can reference.
const REGISTERED_COMPONENTS = {
Slider,
Modal,
}
function init() {
@nmquebb
nmquebb / useInputHandler.js
Created January 27, 2020 20:54
Simple form management hook
import { useState } from "preact/hooks";
export function useInputHandler(defaultState) {
const [state, setState] = useState(defaultState);
return [
state,
event => setState({ ...state, [event.target.name]: event.target.value }),
newState => setState({ ...state, ...newState })
];
@nmquebb
nmquebb / gist:4e55494157e6dd2ce10415976ae52772
Last active February 4, 2020 04:41
Twitch bonus collector
setInterval(() => {
const btn = document.querySelector(".community-points-summary button.tw-button--success");
btn && btn.click();
}, 15000)
@nmquebb
nmquebb / Example.js
Last active March 31, 2020 01:45
Hu
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
portalId: "7229407",
formId: "3acc29ec-3985-4f68-afd3-4b1abdd130ec",
cssClass: 'bg-dark',
function createSentenceArray(str) {
const arr = str.split(" ");
const newArr = [];
for (let index = 0; index < arr.length; index++) {
const word = arr[index];
if (DO_YOUR_REGEX_THING) {
// if it is a mention push a span
newArr.push(<span>{word}</span>)
import { ChangeEvent, useState } from 'react';
type InputEvent = ChangeEvent<HTMLInputElement | HTMLSelectElement>;
type BindValueType = (e: InputEvent) => void;
export type BindInputType<T> = (
name: keyof T
) => {
name: typeof name;
value: T[typeof name];