gitflow | git |
---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint node: true */ | |
"use strict"; | |
var express = require("express"), | |
consolidate = require("consolidate"), | |
Handlebars = require("handlebars"), | |
fs = require("fs"); | |
var app = express(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Duplicate a select list using jQuery</title> | |
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script src="selectScript.js"></script> | |
</head> | |
<body> | |
<div id="d1"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function translateError(msg) { | |
var newErr = new Error(msg); // placed here to get correct stack | |
return e => { | |
newErr.originalError = e; | |
throw newErr; | |
} | |
} | |
async function asyncTask() { | |
const user = await UserModel.findById(1).catch(translateError('No user found')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Secure sessions are easy, but it's not very well documented, so I'm changing that. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT] | |
To do this, here's what you need to do: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Creating an SSH key for you..." | |
ssh-keygen -t rsa | |
echo "Please add this public key to Github \n" | |
echo "https://github.com/account/ssh \n" | |
read -p "Press [Enter] key after this..." | |
echo "Installing xcode-stuff" | |
xcode-select --install |
From within the parent repo do
git submodule add [email protected]:iracooke/transcriptomes.git/wiki wiki
git commit -m "Adding wiki as submodule"
git push
Making changes to the wiki and to the parent require separate git commit commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { InMemoryLRUCache } = require("apollo-server-caching"); | |
const DataLoader = require("dataloader"); | |
class SQLCache { | |
constructor(cache = new InMemoryLRUCache(), knex) { | |
this.cache = cache; | |
this.loader = new DataLoader(queries => | |
Promise.all(queries.map(query => knexInstance.raw(query))) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// place in pages/sitemap.xml.tsx | |
const fs = require('fs') | |
import { endpoint } from '../config' | |
const Sitemap = () => null | |
Sitemap.getInitialProps = async ({ res }) => { | |
if (!res) return {} | |
const folder = 'pages' | |
res.setHeader('content-type', 'application/xml') |