Skip to content

Instantly share code, notes, and snippets.

View Noitidart's full-sized avatar

Noitidart Noitidart

View GitHub Profile
/**
* Convert a file size given in bytes to human readable sizes.
* Source: https://stackoverflow.com/a/18650828/1828637
*
* @param {number} bytes
* @param {number} decimals - Should be >= 0, if less than 0 it is adjusted to 0.
*/
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
import * as _ from 'lodash';
_.times(18, i => 2 ** Math.floor(i / 2) * 1000),
_.times(28, i => Math.floor(i / 2) ** 2 * 1000)
@Noitidart
Noitidart / stackoverflow-query-search-comments.txt
Last active May 20, 2020 01:17
Search for comments by tag of post
// https://data.stackexchange.com/stackoverflow/query/1027054/search-posts-by-userid-comment-text?CommentText=ios&TagName=react-native
SELECT Posts.Id AS [Post Link], Comments.Text, Comments.CreationDate
FROM Comments
LEFT JOIN Posts ON Posts.Id = Comments.PostId
WHERE UPPER(Comments.Text) LIKE UPPER('%##CommentText##%')
AND Comments.UserId = '1828637'
AND Posts.Tags LIKE '%<##TagName##>%'
ORDER BY Comments.CreationDate DESC
// client -> loadbalancer -> server -> machine

class Server {
    private HashMap<Integer, Machine> machineByPersonId;    
}

class Machine{
    private int id;
 private HashMap personById; 

Frontend Focused Full-Stack Software Engineer

Type: On-site Level: L2 / SWE2

  1. (Type: Behavioral) I went through Amazon leadership principals and examples at work. He asked about community driven, customer driven products like NativeShot. He asked about tickets I got. I gave him example of bias for action where I took a low priority ticket and made it high priority without manager approval, because it was for a muti-million dollar deal. I talked about how the AWS docs were too geeky and not customer focused, and how I stuck with my "always right gut" feeling and kept a nose out. I did disagree and commit though, and didn't push until I had facts.

  2. (Type: Whiteboard Code) This actually was more design then code, even though I had a design/architecutre session letter. I had to design an async TaskQueue without using workers. Tasks should run serially, meaning it should not do next task until this task is done. He gave me it should be used like this:

Generic Software Engineer Internship

Type: Phone

He just straight jumped into code after talking a little about the extension I made for Twitch.

Question

Given a a json object that has a start and stop offset, and severity, return a list of words that contain at least one character from any of the offsets, and have a severity above 5.

const Cloud = require('../assets/dependencies/cloud');
const ioClient = require('socket.io-client');
const sailsIO = require('../assets/dependencies/sails.io');
const mockSailsSockets = require('./utils/mockSailsSockets');
let sails;
// Before running any tests...
before(function(done) {
const Cloud = require('../assets/dependencies/cloud');
const ioClient = require('socket.io-client');
const sailsIO = require('../assets/dependencies/sails.io');
const mockSailsSockets = require('./utils/mockSailsSockets');
let sails;
// Before running any tests...
before(function(done) {
class SocketActivity {
static get Status() {
return {
CONNECT: 'connect',
DISCONNECT: 'disconnect',
RECONNECT: 'reconnect'
};