Skip to content

Instantly share code, notes, and snippets.

View Archakov06's full-sized avatar

Archakov Dennis Archakov06

View GitHub Profile
// Source: https://github.com/zewish/oget
'use strict';
export default (obj, path, def) => {
let res = path
.replace(/\[/g, '.')
.replace(/\]/g, '')
.replace(/^\./, '')
.split('.')
import baseGet from './.internal/baseGet.js'
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
@Archakov06
Archakov06 / get.js
Created April 21, 2018 21:22
Lodash like _.get() function
const obj = {
a: {
b: {
c: 1
}
},
user: {
id: {
bbb: 123
},
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\User;
use App\Question;
use App\UploadedFile;
class Answer extends Model
@Archakov06
Archakov06 / AudioPlayer.js
Created January 31, 2018 21:34
audioplayer.js
import React from 'react';
import styled from 'styled-components';
import { Sprites } from './';
import { COLORS } from '../constants/styles';
const AudioBlock = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
width: 300px;
@Archakov06
Archakov06 / Button.js
Last active January 18, 2018 12:39
Button.js
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import PlusIcon from 'react-icons/lib/fa/plus';
import CheckIcon from 'react-icons/lib/fa/check';
import { COLORS } from '../constants/styles';
const StyledButton = styled.button`
display: flex;
[
{
"data": [
{
"date": "Friday, 1st December 2017",
"day": "1",
"fullName": "Demo Master",
"phone": null,
"serviceName": "Proverka",
},
import Room from '../models/Room';
import { isEmpty, shuffle } from 'lodash';
import wordsList from '../public/words';
class RoomController {
get(req, res, next) {
const { room } = req.params;
Room.find({ room }, (err, room) => {
if (!err && !isEmpty(room)) {
res.json(room);
// config.js
const merge = require('lodash').merge;
const config = {
// Common configuration section
sentry: {
url: 'https://',
},
mongodbUri: 'mongodb://',
url: global.hasOwnProperty('location') ? global.location.origin + '/' : '',
// app.js
import express from 'express';
import bodyParser from 'body-parser';
import methodOverride from 'method-override';
import session from 'express-session';
import cookieParser from 'cookie-parser';
import errorHandler from 'errorhandler';
import morgan from 'morgan';
import flash from 'connect-flash';