Skip to content

Instantly share code, notes, and snippets.

@joeybaker
joeybaker / couchconfig.md
Created July 16, 2014 19:30
configuring couchdb

couchdb setup

  • create an admin user
  • then
couch_httpd_auth
    require_valid_user = true
couchdb
    delayed_commits = false
couch_httpd_auth
@joeybaker
joeybaker / newubuntuserver.md
Created July 16, 2014 19:29
setup a new ubuntu server

new ubuntu server

# add a non-root user
sudo adduser <username> sudo
su <username>
# paste in your ssh key
# ssh-copy-id -i <username>@<host> 
sudo vi /etc/ssh/sshd_config
# set PasswordAuthentication no
@joeybaker
joeybaker / bud.xml
Last active August 29, 2015 14:04
svc config for bud-tls on SmartOS
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Created by Manifold
--><service_bundle type="manifest" name="bud">
<service name="bud" type="service" version="1">
<create_default_instance enabled="true"/>
@joeybaker
joeybaker / onFeatureBranches.md
Last active August 29, 2015 14:03
github flow modified

I'm a big fan of github flow. Which basically states that you should create a branch for each feature, then merge it into master only when it's ready to push to production. However, github flow is a bit ambiguous about how to resolve conflicts between your feature branch and master. What follows is a method of dealing with that problem.

  • Anything in the master branch is deployable
  • To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request
  • After someone else has reviewed and signed off on the feature, you can merge it into master
  • a really good addition: how to merge into master. Here's why
@joeybaker
joeybaker / cp_export.sh
Last active November 21, 2017 00:22
Export from a couch potato database
# print all the titles in the db
strings -a -t x id_stor | pcregrep -M '[a-z0-9]{1,9}\stitles\[\n[a-z0-9]{1,9}\s(.*?)u$' | grep -v 'titles' | cut -d " " -f 2- | sort | uniq | sed 's/u$//' | sed 's/://' | sed 's/\///' > couchpotato_export.txt
# get all current movies
# note: with GNU sed, the `sed -E` should be `sed -r`
ls /Volumes/raid6/Movies | sed 's/ ([0-9][0-9][0-9][0-9])//' | sed -E 's/(.*), The/The \1/' | sort > movie_files.txt
# get the wanted movies
grep -v -f couchpotato_export.txt movie_files.txt
@joeybaker
joeybaker / sslterminators.md
Last active August 29, 2015 14:02
ssl terminator research
@joeybaker
joeybaker / nosudonpm.sh
Created May 28, 2014 21:43
Don't need sudo for npm install
# no sudo for global installs!
sudo chown -R `whoami` ~/.npm; sudo chown -R `whoami` /usr/local/lib/node_modules
@joeybaker
joeybaker / onbeforeunload.js
Created October 15, 2013 21:42
Show the user a warning before they leave the page if AJAX has yet to complete.
// if the user attempts to navigate away from the page before ajax is complete, warn.
$.ajaxPrefilter(function(/*options, originalOptions, jqXHR*/) {
window.onbeforeunload = function(){
return 'Please allow ajax to complete'
}
})
// remove the warning when AJAX is done
$(document).ajaxComplete(function(){
window.onbeforeunload = void 0

We're going to refactor a library to make it more usable. The intention is to get the code to a point where it's a reusable component.

The library to refactor is: https://github.com/01miru/fileuploaderjs

ToDo List

This is a non-comprehensive list of things to do:

  • Convert to use jQuery instead of native browser code where possible
  • Add tests
  • Convert it UMD. Don't pollute the global scope.

Build a re-usable HTML component that allows a user to submit a bug report about the page they're viewing.

  • The client-side component should be standalone, and easily re-usable in wider app. It's okay to require a framework(s), but dependencies must be easy to manage.
  • Also build out a server that can receive these bugs, parse them, and send them to the Github API as new issues. You can use whatever server environment you'd like.
  • To enable the github API, you should probably create a new repo. Alternatively you can mock out the Github API responses.

You should build this as if you were going to put it into production: optimize for code quality over quantity, write tests as appropriate, and so on.

It's fine if you don't actually finish.