Skip to content

Instantly share code, notes, and snippets.

@ohmyhusky
ohmyhusky / formikApollo.js
Created November 24, 2018 23:58 — forked from mwickett/formikApollo.js
Formik + Apollo
import React from 'react'
import { withRouter, Link } from 'react-router-dom'
import { graphql, compose } from 'react-apollo'
import { Formik } from 'formik'
import Yup from 'yup'
import FormWideError from '../elements/form/FormWideError'
import TextInput from '../elements/form/TextInput'
import Button from '../elements/form/Button'
import { H2 } from '../elements/text/Headings'
@ohmyhusky
ohmyhusky / README-setup-tunnel-as-systemd-service.md
Created November 24, 2018 00:59 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@ohmyhusky
ohmyhusky / import_notes_app_to_evernote.applescript
Created January 7, 2018 11:12 — forked from sowenjub/import_notes_app_to_evernote.applescript
Updated to import the modification date as well since that's how notes are sorted in Note.app
tell application "Notes"
set theNotes to every note of the folder "Notes"
repeat with thisNote in theNotes
set myTitle to the name of thisNote
set myText to the body of thisNote
set myCreateDate to the creation date of thisNote
set myUpdateDate to the modification date of thisNote
tell application "Evernote"
set theTransferredNote to create note with html myText ¬
title myTitle ¬
@ohmyhusky
ohmyhusky / headless.md
Created December 28, 2017 04:58 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

1. Build GraphQL server using `express-graphql` package.
2. Configure `schema.js` file.
3. Query for data.
@ohmyhusky
ohmyhusky / what-forces-layout.md
Created July 14, 2017 05:56 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@ohmyhusky
ohmyhusky / introrx.md
Created June 5, 2017 13:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ohmyhusky
ohmyhusky / react_fiber.md
Created April 10, 2017 07:16 — forked from geoffreydhuyvetters/react_fiber.md
What is React Fiber? And how can I try it out today?
@ohmyhusky
ohmyhusky / request.sh
Created March 30, 2017 05:32 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@ohmyhusky
ohmyhusky / sroll_on_drag.js
Created March 21, 2017 00:09 — forked from gaearon/sroll_on_drag.js
Scroll on drag with react-dnd
configureDragDrop(registerType) {
var imageThreshold = Math.max(120, window.innerHeight / 4),
sectionThreshold = Math.max(140, window.innerHeight / 4),
currentDY = 0,
frame;
function makeScrollingHandler(threshold) {
function getScrollDY(clientY) {
var speed;
if (clientY < threshold) {