Skip to content

Instantly share code, notes, and snippets.

@ihgrant
ihgrant / index.html
Last active March 3, 2020 18:23
2016 voter turnout by state
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
<script src="https://d3js.org/d3-array.v1.min.js"></script>
<script src="https://d3js.org/d3-collection.v1.min.js"></script>
import React, { Component } from "react";
import { Link, Redirect } from "react-router-dom";
import SweetAlert from "sweetalert2-react";
import { connect } from "react-redux";
import { Card, Form, Button, Divider } from "semantic-ui-react";
import "../../../../css/style.css";
import HomePageHeader from "../Headers/HomePageHeader";
import MainFooter from "../Footers/MainFooter";
@ihgrant
ihgrant / object.js
Created February 28, 2018 23:35 — forked from santaclauze/object.js
const stepsConstructor = children.map(el => {
const step = el.props;
return {
settings: {
name: step.name,
status: step.status
},
options: step.options
};
});
@ihgrant
ihgrant / notes.md
Created November 20, 2017 15:31
making a linux usb stick on macos
  • download the iso
  • plug in usb
  • find out the device name: diskutil ls. It'll be something like disk2. subsequent devices e.g. disk2s1 are partitions of that device, one of which shows up in /Volumes as an external drive.
  • unmount the partition you see in /Volumes (eject or diskutil unmount <path to partition>). the path to the partition will be like /dev/disk2s1.
  • write the iso image to the usb: sudo dd if=<path to iso image> of=<path to device> bs=1048576. the path to the device will be like /dev/disk2.

reference: https://community.linuxmint.com/tutorial/view/744

@ihgrant
ihgrant / post.md
Last active September 15, 2017 17:28
hosting nodejs in azure
  • you need a .deployment file in your project root (see example). This tells Kudu (Azure's deployment engine) what else it needs to do beyond copying the files. https://github.com/projectkudu/kudu/wiki/Customizing-deployments
  • this runs a deploy shell script to install dependencies and build your app after azure instantiates the docker container with your files in it.
  • by default, azure will look for a 'start' NPM script and run that to start your app.
@ihgrant
ihgrant / ghost
Last active May 18, 2017 02:00
nginx ghost config
upstream ghost_upstream {
server 127.0.0.1:2368;
keepalive 64;
}
server {
server_name blog.chenghiz.net;
add_header X-Cache $upstream_cache_status;
location / {
proxy_cache STATIC;
@ihgrant
ihgrant / notes.md
Last active May 18, 2017 02:00
linode notes

all notes written for ubuntu 16.04 LTS

mv - rename and/or move files adduser - add user which - path to bin

nginx

  • nginx lives at /etc/nginx
  • roughly speaking, the configs in ./sites-enabled define sites that are being served
  • ./sites-available is a sort of staging area

Keybase proof

I hereby claim:

  • I am ihgrant on github.
  • I am ihgrant (https://keybase.io/ihgrant) on keybase.
  • I have a public key whose fingerprint is 01A8 6F49 0AA3 4B78 6CFE 536B 6408 EA5B E5C1 A0D2

To claim this, I am signing this object:

@ihgrant
ihgrant / example.js
Created February 17, 2017 17:28
GET a bunch of stuff and swallow failures
const getAndIgnoreFail = (fn) => {
return fn.catch(err => []);
};
Promise.all([
getAndIgnoreFail(axios.get('whatever')),
getAndIgnoreFail(axios.get('whatever2')),
getAndIgnoreFail(axios.get('whatever3')),
...
]).then(([whatever1, whatever2, whatever3, ...]) => {
@ihgrant
ihgrant / rome-calendar.jsx
Last active January 31, 2017 16:40
React wrapper for rome calendar widget
const React = require('react');
const rome = require('rome');
const moment = require('moment');
const RomeCalendar = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
handleChange: React.PropTypes.func,
id: React.PropTypes.string,
jqm: React.PropTypes.bool,