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
module.exports = function bulkUpsert(model, key, values) { | |
function _find(where) { | |
return model.findOne({ where }) | |
} | |
function _update(value, where) { | |
return model | |
.update(value, { where }) | |
.then(() => _find(where)) | |
} |
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
# Published on Docker Hub with above user alexellisio. | |
# If you want to rebuild your own copy, follow below instructions | |
# Build this on each type of machine so you have the correct CPU extensions. | |
FROM ubuntu:latest | |
WORKDIR /root/ | |
RUN apt-get update -qy && \ | |
apt-get install -qy cmake build-essential libboost-all-dev git ca-certificates \ | |
--no-install-recommends |
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
FROM alpine | |
RUN apk add --update --no-cache nodejs | |
RUN npm i -g yarn | |
ADD package.json yarn.lock /tmp/ | |
ADD .yarn-cache.tgz / | |
RUN cd /tmp && yarn | |
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules |
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
alias git="docker run -ti --rm -v $(pwd):/git bwits/docker-git-alpine" |
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
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf | |
charset = utf-8 |
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
'use strict' | |
const Squeak = require('squeak') | |
const logger = new Squeak() | |
.type('sync', { | |
color: 'cyan', | |
prefix: '+ sync' | |
}) | |
.type('event', { |
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
/** | |
* Generates number of random geolocation points given a center and a radius. | |
* @param {Object} center A JS object with lat and lng attributes. | |
* @param {number} radius Radius in meters. | |
* @param {number} count Number of points to generate. | |
* @return {array} Array of Objects with lat and lng attributes. | |
*/ | |
function generateRandomPoints(center, radius, count) { | |
var points = []; | |
for (var i=0; i<count; i++) { |
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
# Thanks to http://stackoverflow.com/questions/2781549/removing-input-background-colour-for-chrome-autocomplete | |
input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill { | |
box-shadow: 0 0 0px 1000px white inset; | |
-webkit-box-shadow: 0 0 0px 1000px white inset; | |
} |
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
curl -s \ | |
-H "Accept: application/json" \ | |
-H "Content-Type:application/json" \ | |
-X PUT --data '{ "name": "username_user", "password": "password_here" }' \ | |
https://registry.npmjs.org/-/user/org.couchdb.user:username_user |
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
import React, { Component } from 'react'; | |
const hasDataForThisKey = (staticContext) => | |
(key) => staticContext && Object.keys(staticContext.data).includes(key); | |
const windowHasDataForThisKey = (window) => | |
(key) => Object.keys(window.__DATA__).includes(key); | |
export default ({ | |
key, |