Skip to content

Instantly share code, notes, and snippets.

View evilboss's full-sized avatar
🏠
Working from home

Jr Reyes evilboss

🏠
Working from home
  • Tarlac
View GitHub Profile
@evilboss
evilboss / combine.js
Last active December 9, 2019 14:14
combine arrays
let firstDay = ['ip1', 'ip2', 'ip3']
let secondDay = ['ipx', 'ipy', 'ipz']
console.log([...firstDay, ...secondDay]);
@evilboss
evilboss / rank.js
Created March 21, 2017 14:23
Code Test: You have an array of objects in JavaScript. Each one contains a name (a string) and ranking (a number). Write two functions, one to return the objects ordered by ranking and another to return the average ranking. Write your code in a secret gist (https://gist.github.com/) and paste the URL below.*
import _ from 'underscore';
let ranks = [{name:'one',rank:1},{name:'two',rank:2}];
let getByRanks = (ranks)=>{
return _.sortBy(_pluck(ranks,'rank'), function(num) {
return num;
})
};
let getRankAverage = (ranks)=>{
@evilboss
evilboss / applicant.server.model.tests.js
Created August 5, 2015 03:40
'use strict'; /** * Module dependencies. */ var should = require('should'), mongoose = require('mongoose'), User = mongoose.model('User'), Applicant = mongoose.model('Applicant'); /** * Globals */ var user, applicant; /** * Unit tests */ describe('Applicant Model Unit Tests:', function() { beforeEach(function(done) { user = new User({ firstName:…
'use strict';
/**
* Module dependencies.
*/
var should = require('should'),
mongoose = require('mongoose'),
User = mongoose.model('User'),
Applicant = mongoose.model('Applicant');