Skip to content

Instantly share code, notes, and snippets.

View emil-alexandrescu's full-sized avatar
🏠
Working from home

Emil Alexandrescu emil-alexandrescu

🏠
Working from home
  • Bucharest, Romania
View GitHub Profile
# Add the function to the .zshrc and update your console environment
function git-mass-cherry-pick {
# The exact commit from which the cherry-picking will start.
readonly start=${1:?"Starting commit SHA must be specified."}
local branch_name=$(git rev-parse --abbrev-ref HEAD);
local bak_name="bak/${branch_name}"
# Remember commits to be cherry-picked
local commits_to_cherry_pick=()
for commit in $(git log $start^1.. --no-merges --reverse --pretty=%H --abbrev-commit);

React Native Coding Challenge

IMPORTANT! Please do not use Expo.

In this challenge you're going to create a basic Reddit app with React Native.

Reddit is a news website where registered users can submit posts or links to content that other users can vote and comment. Each of these posts is grouped into categories known as "subreddits".

Your web app should list the last posts of the r/pics subreddit.

/* eslint-disable react/display-name */
import React from 'react';
import { shallow } from 'enzyme';
import { Redirect } from 'react-router';
import withAuthGuard from '../withAuthGuard';
jest.mock('../withUser');
import withUser from '../withUser';
const AnyComponent = () => <div>Emil is Awesome</div>;
import React from 'react';
import PropTypes from 'prop-types';
import { graphql } from 'react-apollo';
import { GET_CURRENT_USER } from './withUser';
import { localStorage } from '@common/lib';
import gql from 'graphql-tag';
export const LOGIN_MUTATION = gql`
mutation loginMutation($usernameOrEmail: String!, $password: String!) {
loginUser(usernameOrEmail: $usernameOrEmail, password: $password) {
const _ = require('lodash');
const moment = require('moment');
const shortid = require('shortid');
const Promise = require('bluebird');
const User = require('../models/user');
const Team = require('../models/team');
const RoleService = require('../services/role.service');
const APIError = require('../utils/api-error');
const sendEmail = require('../utils/send-mail');
const config = require('../../config/config');
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Scrollbars } from 'react-custom-scrollbars';
import { listenClick } from 'lib/utils';
import './style.scss';
export const Tooltip = ({ items }) => (
<ul className="tooltip__list-tooltip">
{items.map(item =>
@emil-alexandrescu
emil-alexandrescu / withQuery.js
Created February 26, 2019 16:04
HOC to take control of search query on url
import React, { Component } from 'react';
import { updateQuery, getQuery, getPathname } from 'lib/history';
import capitalize from 'lodash/capitalize';
import mergeWith from 'lodash/mergeWith';
import merge from 'lodash/merge';
import isArray from 'lodash/isArray';
import isObject from 'lodash/isObject';
function withQuery(name, defaultValues, storeCache = false, cacheIgnoredValues = []) {
return function(WrappedComponent) {
@emil-alexandrescu
emil-alexandrescu / typeahead.test.js
Created January 26, 2018 15:48
Typeahead unit test
import React from 'react';
import { shallow, mount } from 'enzyme';
import Typeahead from 'components/Typeahead';
describe('components', () => describe('<Typeahead />', () => {
let props = {};
let options = [];
beforeEach(() => {
options = [
@emil-alexandrescu
emil-alexandrescu / Dockerfile
Created October 24, 2017 22:40 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->