Skip to content

Instantly share code, notes, and snippets.

David Mason davidmason

Block or report user

Report or block davidmason

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidmason
davidmason / reviewable-diff-plusminus.css
Created Sep 14, 2017
Some styles to add + and - next to diff lines in reviewable
View reviewable-diff-plusminus.css
.diff.line.replace:before {
content: "+";
margin-left: 14px;
}
.diff.line.edit:before {
content: "-";
margin-left: 14px;
}
@davidmason
davidmason / install-watchman.bash
Created Sep 13, 2017
To install watchman on Fedora 26, these are all the hoops I had to jump through.
View install-watchman.bash
# The following packages are needed during `make`
# - openssl-devel so you don't get:
# ContentHash.cpp:13:10: fatal error: openssl/sha.h: No such file or directory
# - redhat-rpm-config so you don't get:
# gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
# - python-devel so you don't get:
# pywatchman/bser.c:31:10: fatal error: Python.h: No such file or directory
sudo dnf install openssl-devel redhat-rpm-config python-devel
# The rest is just instructions from
@davidmason
davidmason / MyComponent-broken.js
Created Jun 14, 2017
Debounce fails if you use it inside your callback. Here is how to fix it.
View MyComponent-broken.js
/*
* This is roughly the code I found. A callback is passed in props,
* and the author attempts to make a debounced version of the callback
* so that it will only trigger at most once every 200ms.
*
* Debounce is used when we are getting lots of events and want to
* avoid a costly operation (e.g. network request) on every one. It
* wraps a callback and returns a debounced callback that will only
* trigger the callback on the newest call when there is a break in
* activity. A common use-case is to request a search as a user types,
@davidmason
davidmason / monitor-sizes.html
Created Sep 27, 2016
Visualize a few different screen sizes, to help me decide on a laptop display size.
View monitor-sizes.html
<!DOCTYPE html>
<html>
<head>
<!-- Useful screen size calculators: http://www.silisoftware.com/tools/screen.php -->
<style type="text/css">
body {
View simple-html5-template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Commonly used HTML things</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
@davidmason
davidmason / graphics-play.elm
Created Dec 1, 2015
playing around with Elm graphics to see what sort of things I can do
View graphics-play.elm
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Time exposing (fps)
import Transform2D exposing (scaleX)
framerate = 100.0
cow = image 24 28 "http://i.neoseeker.com/cm/42/badges/BCow2.png"
chicken = image 40 40 "http://fogu.com/hm/snes/img/chicken.gif"
@davidmason
davidmason / pirates.elm
Last active May 31, 2016
Just playing around... or perhaps a comprehension challenge. Can you figure out what this code does? Try it in http://elm-lang.org/try
View pirates.elm
import Html exposing (text)
main = drink rum ye scurvies |> yarrrrrr
drink up me hearties =
case hearties of
[] -> me
cap'n :: lads -> drink up me lads |> up cap'n
yarrrrrr = text << toString
@davidmason
davidmason / function-basics.rb
Last active Aug 29, 2015
Learning some basics of Ruby functions. Try it in http://repl.it/languages/Ruby
View function-basics.rb
# This evening I got Ally (https://github.com/AllyG) to
# show me some basics for methods/functions in Ruby.
# I still have some major gaps in my mental model of all
# this, but I feel like I know a lot more than I did this
# morning.
def haldo name
puts "Haldo " + name
end
@davidmason
davidmason / node-on-rhel6.md
Last active Aug 29, 2015
Simple node setup on RHEL6
View node-on-rhel6.md

node setup on RHEL6

These are the steps I used today to get node installed and working on my Red Hat Enterprise Linux 6 machine. Note that the first step can cause potential issues, so you should understand and weigh those up. You can skip the first step, it just means you will have to run global module installs (npm install -g ...) with elevated permissions (sudo/su).

  1. change owner of /usr/local so that npm install -g will Just Work. I think this has to go before installing node so that everything works properly.
sudo chown -R $USER /usr/local
@davidmason
davidmason / prep.md
Last active Aug 29, 2015
Preparation for campjs talk "Packaging CommonJS for the browser: Webpack and Browserify"
View prep.md

If you just want to watch the talk, you don't need anything. If you want to follow along or play around with webpack and/or browserify at the camp, I recommend preinstalling the following before setting out.

Preinstallation

Just in case the npm mirror is not available at the camp, you can preinstall the following if you want to play around with browserify and webpack:

install nodejs

nodejs is the runtime on which webpack and browserify run (just in case youmanaged not to hear about it somehow)

You can’t perform that action at this time.