Skip to content

Instantly share code, notes, and snippets.

View buwilliams's full-sized avatar

Buddy Williams buwilliams

View GitHub Profile
@buwilliams
buwilliams / typescript.md
Last active June 7, 2021 13:44
Questioning TypeScript

My guiding value of frontend development: Changability

TLDR: TypeScript vs JavaScript is a programming war. A war over dynamic typing vs static typing. My view is that TypeScript introduces too many concepts to be worth it's benefits.

Exploring a nagging feeling

Feelings, in my view, are signals, they exist to communicate complex thoughts. Often, I've found myself saying, that

@buwilliams
buwilliams / resume.md
Last active February 18, 2021 13:42
Resume

Buddy Williams

Lead Full-stack Developer

About

  • Experienced full-stack developer focused on the front-end and what’s best for users. I specialize in technology innovation within startups. I spend most of my time thinking about the future and what I can do to shape it.
@buwilliams
buwilliams / sort_options.js
Created December 2, 2020 22:21
Sorting select options
// Run this function after page load
// Example: sortOptions('select#wsl_categories option')
function sortOptions(selector) {
let $ = window.jQuery;
let options = jQuery(selector);
let arr = options
.map(function (_, option) {
return {
text: jQuery(option).text(),
@buwilliams
buwilliams / search_icons.js
Created July 27, 2018 16:36
Search for Icons in JSON
var icons = {
"cog": {
"search": "cog settings"
},
"disk": {
"search": "disk save"
}
}
function search(icons, searchString) {
@buwilliams
buwilliams / map_keys.go
Created July 9, 2018 14:22
Map of object with unknown keys
package mapkeys
import (
"encoding/json"
)
type Json struct {
People map[string]Person `json:"people"`
}
@buwilliams
buwilliams / experiment.js
Created April 9, 2018 15:17
Preact without JSX
function Component(data) {
var self = this;
this.app = document.querySelector('#app');
this.setState(data);
document.querySelector('#reset').addEventListener('click', function() {
self.setState(data);
});
document.querySelector('#change').addEventListener('click', function() {
class Dog
def speak
puts 'Ruff! Grr! Roof! Rawr!'
end
end
class Cat
def speak
puts 'Meeeow...'
end
@buwilliams
buwilliams / flat.js
Created June 23, 2017 12:44
Example of how to flatten a javascript array with no dependencies
// Run with browser devtools or nodejs
function flat (array) {
var out = []
array || (array = [])
function recur (internalArray) {
for (var i=0; i<internalArray.length; i++) {
var item = internalArray[i]
if (Array.isArray(item)) {
@buwilliams
buwilliams / revealed_word.rb
Created December 30, 2015 00:08
Revealed Word for Hangman
word = "Vadar"
guesses = ["a", "r"]
revealed_word = word.chars.map { |c|
guesses.include?(c) ? c : '-'
}.join('')
puts revealed_word
@buwilliams
buwilliams / gist:8770147
Created February 2, 2014 15:38
Hello World map to JSON
(ns mybudgetbuddy-clj.core
(:use compojure.core
ring.middleware.json
ring.util.response)
(:require
[ring.adapter.jetty :as jetty]))
(defn index [request] (response {:say "hello world"}))
(defroutes main-routes