create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Name | MIMEType | Extension | Description | |
---|---|---|---|---|
aac | audio/aac | .aac | AAC audio file | |
abw | application/x-abiword | .abw | AbiWord document | |
arc | application/octet-stream | .arc | Archive document (multiple files embedded) | |
avi | video/x-msvideo | .avi | AVI: Audio Video Interleave | |
azw | application/vnd.amazon.ebook | .azw | Amazon Kindle eBook format | |
bin | application/octet-stream | .bin | Any kind of binary data | |
bz | application/x-bzip | .bz | BZip archive | |
bz2 | application/x-bzip2 | .bz2 | BZip2 archive | |
csh | application/x-csh | .csh | C-Shell script |
import { Platform, ActionSheetIOS } from 'react-native'; | |
import DocumentPicker from 'react-native-document-picker'; | |
import ImagePicker from 'react-native-image-picker'; | |
import RNFS from 'react-native-fs'; | |
type Captions = { | |
image: string, | |
document: string, | |
cancel: string, | |
title: string, |
var db = mongoose.connect('mongodb://localhost:27017/DB'); | |
// In middleware | |
app.use(function (req, res, next) { | |
// action after response | |
var afterResponse = function() { | |
logger.info({req: req}, "End request"); | |
// any other clean ups |
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
// async function | |
async function fetchAsync () { | |
// await response of fetch call | |
let response = await fetch('https://api.github.com'); | |
// only proceed once promise is resolved | |
let data = await response.json(); | |
// only proceed once second promise is resolved |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
// the main app file | |
import express from "express"; | |
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
import authenticate from "./authentication"; // middleware for doing authentication | |
import permit from "./permission"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
/** | |
* Simple authentication and authorization example with passport, node_acl, | |
* MongoDB and expressjs | |
* | |
* The example shown here uses local userdata and sessions to remember a | |
* logged in user. Roles are persistent all the way and applied to user | |
* after logging in. | |
* | |
* Usage: | |
* 1. Start this as server |
// get the average color of two hex colors. | |
function avgcolor(color1,color2){ | |
var avg = function(a,b){ return (a+b)/2; }, | |
t16 = function(c){ return parseInt((''+c).replace('#',''),16) }, | |
hex = function(c){ var t = (c>>0).toString(16); | |
return t.length == 2 ? t : '0' + t }, | |
hex1 = t16(color1), | |
hex2 = t16(color2), | |
r = function(hex){ return hex >> 16 & 0xFF}, | |
g = function(hex){ return hex >> 8 & 0xFF}, |