Skip to content

Instantly share code, notes, and snippets.

View mthadley's full-sized avatar
💾
Loading...

Michael Hadley mthadley

💾
Loading...
View GitHub Profile
@arsduo
arsduo / gist:1f5408da027fd1ffd1718e962925cec4
Created April 1, 2021 02:55
Facebook Recruiter Response (feel free to use!)
Hi $recruiter_name,
Thanks for the email!
$your_positive_impact(optional)
Facebook, in that same time period, has built an impressive (and well-reported) track record of its own, with accomplishments ranging from real name policies that made life dangerous for trans people, to the use of WhatsApp to spread dangerous viral rumors in places with histories of mob violence, to actively strategizing with political disinformation campaigns in order to maximize advertising revenue, to allowing popular conservative sites and personalities to violate Facebook's terms of service because conspiracy theories get more clicks.
All of which is to say, as fantastic as an opportunity to be paid in Facebook's still-upcoming cryptocurrency would be, I’m afraid I must regretfully decline.
@tenderlove
tenderlove / ngpng.rb
Last active December 12, 2020 14:09
Simple PNG generation example that only depends on zlib in Ruby
# Not Great PNG class. This is a very simple example of writing a PNG. It
# only supports colors from the color palette stored in `@palette`. This is
# meant to be example code, but I am using it in a program for visualizing
# heap dumps from Ruby.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@kofigumbs
kofigumbs / elm_converter.rb
Last active March 30, 2019 19:58
Compile Elm files and include the JavaScript output in a Jekyll site
# Initially based on https://github.com/sonnym/jekyll_elm
#
# USAGE:
# Copy/paste this file into the `_plugins` directory of your Jekyll project.
# For every .elm file in your project, it will generate a .js file in your site
# using the same name and relative path.
#
# As-is, the converter expects the following directory structure:
#
# your-jekyll-project/
@irony
irony / letitsnow.js
Created December 17, 2017 18:34
God Jul Kodapor!
const outside = {weather: FRIGHTFUL}
const inside = {fire: DELIGHTFUL}
const go = places => places.some(p=>p>outside.weather)))
const snow = () => (outside.weather < inside.fire && !go(places)) {
let it = snow()
}
let it = snow()
@evancz
evancz / data-interchange.md
Last active April 29, 2024 16:53
Why do I have to write JSON decoders in Elm?

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

How npm 5+ works with package-lock

Having had hard times understanding how exactly npm processes package-lock.json and at what stages it is being updated, I put a little guide together to sort of reverse engineer in what way the locked dependencies are updated. This is not going to be an exhausting research about every aspects of npm dealing with these locked dependecies, but rather a very quick step-by-step guide that lines up my findings.

Preparations

To get the ball rolling, I prepared a rather simple React boilerplate project to experiment with. It incorporates the very basics needed to generate a "Hello React!" application. This will perfectly make it for our little demonstration.

Let's swiftly take a glimpse through the fundamental project files.

app.js carbon 2

@bryceosterhaus
bryceosterhaus / file.md
Created June 23, 2017 00:14
Callbacks vs. Events

Say you have three nested components. GrandParent -> Parent -> Child. You have state(foo and bar) that lives in Grandparent. That state is then changed by something that happens in Child. There are two different ways to think about how to get this state to change, Event Emitting and Callback passing. I think it would be wise of us to consider switching to a callback approach rather than an Event Emitting. Primarily because I think it reduces unneccessary boilerplate and having to write logic in the "middle man" component, which in this case is the parent.

Here is the code for the two different approaches. Let me know what you think

Event Emitting

{namespace GrandParent}

/**
@drewbrokke
drewbrokke / README.md
Last active February 23, 2017 00:27
Langify - turn sentences into language properties

langify

transform a file full of sentences into the Language.properties format

Usage

langify ./path/to/sentences/file.txt

It will take a file with these contents (that blank line at the end needs to be there):

This is the first sentence.  It's pretty great.
Isn't the second sentence better? I think so.
@mjbradford89
mjbradford89 / AngularPortletFriendlyURLMapper.java
Last active March 28, 2022 11:37
Angular2 in Liferay Portal 7
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS