Skip to content

Instantly share code, notes, and snippets.

View vernonk's full-sized avatar

Vernon Kesner vernonk

  • Bottomline Technologies
  • Charlotte, NC
  • X @vernonk
View GitHub Profile
@vernonk
vernonk / customHook.js
Last active March 14, 2019 15:46
Wanting to understand the best practices of hooks. Is this a bad pattern for a custom hook?
import { useState, useEffect, useRef } from 'react';
// thinking this could be a common 'toggle' hook to abstract
// the keybindings for escape, blur and such
const useToggle = (isOpen, classes) => {
const [open, setOpen] = useState(isOpen);
const sectionEl = useRef(null);
const classesString = (open) ?
`${classes.messageToggle} ${classes.messageToggleOpen}` :
`${classes.messageToggle}`;
@vernonk
vernonk / base-keys.ahk
Created November 20, 2015 08:39
autohotkey base key maps
;custom shortcuts to move between mac & win more easily
SendMode input
#SingleInstance force
;#InstallKeybdHook
;---------------------------------------------------------------
; ! = ALT
; ^ = CTRL
; + = SHIFT
@vernonk
vernonk / learning.md
Created April 28, 2015 23:17
Learning more about building and designing websites

Learning more about building and designing websites

These links can help you learn more about designing and developing websites. I hope you enjoyed the info at the career fair. I wish you the best of luck in your future. Always chase your dreams.

@vernonk
vernonk / A more maintainable gulpfile?
Last active August 29, 2015 14:18
A cleaner gulpfile? Inspired by Thomas Boyt's maintainable Gruntfile approach which I've used for a while now, I think that a similar separated structure makes the most sense for application maintenance and growth. Thoughts? Thomas Boyt's article: http://www.thomasboyt.com/2013/09/01/maintainable-grunt.html
Directory structure
---------------------------
|--tasks/
| |--app/
| |customapptask.js # Exports custom gulp task
| |--plugins/
| |uglify.js # Exports uglify gulp task
|--gulpfile.js
@vernonk
vernonk / JavaScript Questions
Last active December 26, 2015 10:29
JavaScript Questions
A series of JavaScript related questions to be used during technical interviews.
@vernonk
vernonk / what-is-this
Last active December 15, 2015 04:50
Inspired by @Jack_Franklin here's another little JS quiz.
function getMe() {
console.log(this); // what is `this`?
}
var superman = {
fname: "Clark",
lname: "Kent"
};
@vernonk
vernonk / _default.html.haml
Created February 16, 2013 22:56
Helper for using YAML Frontmatter in partials for Middleman. This expects HAML and a specific structuring and naming of partials (/source/partials/components/_COMPONENTNAME.html.haml) although it could be updated pretty easily. The goal behind this is to serve snippets of components (e.g. a "cta" snippet). This partial file would include frontma…
// Example of the partial for cta shown above
---
cta_class: default
cta_text: My Text!
cta_href: '#'
---
%a{:class => "#{cta_class}", :href => "#{cta_href"}"} #{cta_text}