Skip to content

Instantly share code, notes, and snippets.

## Bare Bones
1. Create your droplet, adding the 1-click install dokku app and giving it at least 1GB memory which Dokku will need for deployment, then navigate to your server's IP and complete the process in the dokku form that will exist there. Also be sure you've followed the guide [here](https://gist.github.com/bradley/0c06d3f2d3c63b097ea5e27befd4beb3) to set up the various accounts youll need on your ubuntu server correctly before proceeding.
2. SSH into your droplet: `ssh root@droplet-ip`
3. Create your dokku app: `dokku apps:create app-name`
4. By default your app is located at myapp.mydomain.com. If you want your app to be accessible via the root domain, then just add the root domain as one of your app's domains. `dokku domains:add app-name mydomain.com`.
5. On your local machine, in your project’s Git repository, add your droplet as a remote: `git remote add dokku dokku@droplet-ip:app-name`
6. Dokku will start your node app itself by calling `nmp start` but if you want to modify that create a `Procf
batchFindAll = (model,where,cback,size=10)->
model.count({where})
.then (res)=>
total = res
[0..Math.floor(total/size)].reduce (curr,num)=>
count = num*10
curr.then => cback(where,count,size)
,Promise.resolve()
@jmarceli
jmarceli / README.md
Last active October 31, 2019 09:46
React errors explained

1

You will get one of these:

Uncaught (in promise) TypeError: Cannot read property 'toUpperCase' of undefined(…)

ReactCompositeComponent.js:870 Uncaught TypeError: Cannot read property 'displayName' of undefined

if you try to:

@armw4
armw4 / redux-is-smarter-than-you-think.md
Last active June 19, 2021 20:10
Optimizing your react components via redux....shouldComponentUpdate for free and more...

The Beginning

Yes...it's true...redux is smart....smarter than you even know. It really does want to help you. It strives to be sane and easy to reason about. With that being said, redux gives you optimizations for free that you probably were completely unaware of.

connect()

connect is the most important thing in redux land IMO. This is where you tie the knot between redux and your underlying components. You usually take state and propogate it down your component hiearchy in the form of props. From there, presentational

@bradley
bradley / Digital-Ocean-SSH-and-Subdomains.md
Last active February 5, 2022 04:05
Digital Ocean SSH and Subdomains

Basic Getting Started Ubuntu 16.04

SSH into your server at root:

ssh root@myserver.com

Crate a new user:

adduser my_username

Make the new user a sudo user:

@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
@eastenluis
eastenluis / map-item.js
Created December 6, 2017 15:18
Mongoose GeoJSON schema example
const mapItemSchema = new mongoose.Schema({
name: String,
location: {
// It's important to define type within type field, because
// mongoose use "type" to identify field's object type.
type: {type: String, default: 'Point'},
// Default value is needed. Mongoose pass an empty array to
// array type by default, but it will fail MongoDB's pre-save
// validation.
coordinates: {type: [Number], default: [0, 0]}
@adam-p
adam-p / app.yaml
Last active May 5, 2023 17:40 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@LosAlamosAl
LosAlamosAl / dreamhost-deploy.md
Last active October 17, 2023 07:20
Deploy a GitHub-based static site to Dreamhost

Before begining, make sure your SSH keys are set so you can ssh to your Dreamhost account.

$ ssh-copy-id -i ~/.ssh/id_rsa.pub xxxxxx@cloverdale.dreamhost.com
(you'll need xxxxxx's password here)
$ ssh xxxxxx@cloverdale.dreamhost.com

On the Dreamhost server you should have a directory for your site (e.g. adubdub.com or ispeed.honeyimlost.com (if not, you'll need to make one). You now need to make a git repository for that site (at the same level in the tree) and initialize a bare repo:

This file has been truncated, but you can view the full file.
[
{
"id": "001",
"name": "Bulbasaur",
"img": "http://img.pokemondb.net/artwork/bulbasaur.jpg",
"type": [
"Grass",
"Poison"
],
"stats": {