Skip to content

Instantly share code, notes, and snippets.

View japel's full-sized avatar

Jan Viktor Apel japel

View GitHub Profile
@japel
japel / test.geojson
Created January 26, 2017 09:30
test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function bulkIndexData(data, index, type) {
var temp = Q.when({});
var newArr = [];
for (var k = 0; k < data.length; k++) {
var oneElement = data[k];
newArr.push({"index": {"_index": index, "_type": type, "_id": oneElement.data.id}});
newArr.push(oneElement.data);
}
(function (newArr) {
temp = temp.then(function () {
@japel
japel / self_many2many
Created February 25, 2015 12:26
self referencing many 2 many?
//ModelA
module.exports = {
schema: false,
attributes: {
relationships: {
collection: "ModelB",
via: "rel"
}
}
//ModelB
@japel
japel / test
Last active August 29, 2015 14:05
// Pets
module.exports = {
attributes:{
type: {
type: 'string'
}
}
};
//PetsController
@japel
japel / User.js
Last active August 29, 2015 14:04
"use strict";
var bcrypt = require('bcrypt');
function hashPassword(attrs, next) {
bcrypt.genSalt(10, function(err, salt) {
if (err) return next(err);
bcrypt.hash(attrs.password, salt, function(err, hash) {
if (err) return next(err);