Skip to content

Instantly share code, notes, and snippets.

View tanepiper's full-sized avatar

Tane Piper tanepiper

View GitHub Profile
@tanepiper
tanepiper / lib.spec.js
Created October 31, 2017 20:16
Library test for node-bitly
const expect = require('chai').expect;
require('sepia');
require('../test/bootstrap');
const { generateUrl, sortUrlsAndHash } = require('./lib');
describe('generateUrl', () => {
it('should return a default url', () => {
const result = generateUrl('iamatoken', 'foo');
expect(result.href).to.equal(
@tanepiper
tanepiper / bitly.js
Created October 31, 2017 20:04
The old node-bitly class
'use strict';
const url = require('url');
const isUri = require('valid-url').isUri;
const Boom = require('boom');
require('isomorphic-fetch');
class Bitly {
@tanepiper
tanepiper / example.js
Created September 6, 2017 10:29 — forked from millermedeiros/example.js
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@tanepiper
tanepiper / index.js
Last active September 23, 2025 18:13
#!/usr/bin/env node
const fs = require('fs');
const http = require('http');
const home = process.env.HOME;
const options = {
host: 'example.com',
path: '/',
@tanepiper
tanepiper / index.js
Last active July 11, 2017 14:50 — forked from zkat/index.js
npx is cool
#! /usr/bin/env node
const fs = require('fs');
const http = require('http');
const home = process.env.HOME;
const options = {
host: 'example.com',
path: '/',
sudo apt-get install dokku
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
herokuish
The following NEW packages will be installed
dokku
0 to upgrade, 1 to newly install, 0 to remove and 5 not to upgrade.
Need to get 53.1 kB of archives.
groupadd: group 'dokku' already exists
dpkg: error processing package dokku (--configure):
subprocess installed post-installation script returned error exit status 9
Errors were encountered while processing:
dokku
E: Sub-process /usr/bin/dpkg returned an error code (1)
### Keybase proof
I hereby claim:
* I am tanepiper on github.
* I am tanepiper (https://keybase.io/tanepiper) on keybase.
* I have a public key whose fingerprint is 1061 FF06 58FA 3993 B6C8 7A97 59F9 F0EF 57ED 9AE0
To claim this, I am signing this object:

Our project was using https://github.com/danmartinez101/babel-preset-react-hmre for doing hot-reloading of a React/Redux project we're working on.

Due to an issue I was working on I cleared out the old node_modules folder and did a fresh install. After this, I started seeing this issue:

ERROR in ./src/containers/Root.js
Module not found: Error: Cannot resolve 'file' or 'directory' D:\Documents\GitHub\project\node_modules\babel-preset-react-hmre\node_modules\redbox-react\lib\index.js in D:\Documents\GitHub\project\src\containers
 @ ./src/containers/Root.js 27:13-155
@tanepiper
tanepiper / gist:d5853e1188af7a6eceaa
Created November 17, 2015 11:52
Trying to get some help with server side react-router rendering

So I was working on this last week but switched context - so now back on the problem I'm trying so solve and could do with some help.

I'm working on a handler for Hapi that provides a way to handle routes with react-router, and render react components server side.

Here is an example of how you would set it up: https://github.com/tanepiper/hapi-react-handler/blob/feature/server-side-props/example/index.js

Basically you pass an option per route that you want to render server side and tell it what method to use to generate your props (in this example simple objects, but could query a DB for example)