Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mkozhukharenko's full-sized avatar

Nikolay mkozhukharenko

View GitHub Profile
@danielkcz
danielkcz / firebase.functions.js
Last active January 11, 2019 12:40
Firebase authentication with Graphcool
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// This is hosted using Firebase Functions to gain easier access without meddling with service key
admin.initializeApp(functions.config().firebase)
exports.verifyToken = functions.https.onRequest((req, res) => {
const { idToken } = req.query
if (!idToken) {
const plugins = [
// extract vendor and webpack's module manifest
new webpack.optimize.CommonsChunkPlugin({
names: [ 'vendor', 'manifest' ],
minChunks: Infinity
}),
// extract common modules from all the chunks (requires no 'name' property)
new webpack.optimize.CommonsChunkPlugin({
async: true,
children: true,
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@nickydonna
nickydonna / ControllerRouter.js
Created September 22, 2016 19:53
A Contoller ReactRouter for v4
/* @flow */
import BrowserHistory from 'react-history/BrowserHistory'
import {Push, Replace} from 'react-history'
import React, {Component} from 'react'
import {StaticRouter} from 'react-router'
type RouterProps = {
onChange: (action: string, location: Object) => void,
pathname: string,
navigation?: 'PUSH' | 'REPLACE',
@A-gambit
A-gambit / REACTIVE2016-LIGHTNING-PROPOSAL.md
Last active February 22, 2024 18:24
Proposal for lightning talk at ReactiveConf 2016: Road from UndefinedLand

Proposal for a lightning talk at the Reactive 2016.

Keep calm and like/retweet it on Twitter and star this Gist to vote on this talk.

Road from UndefinedLand

Undefiend

I work at Grammarly. We like React and happily use it in our applications. However, sometimes something goes wrong and bugs creep into the code. Here comes testing. It helps make us confident about the quality of our code.

@moustacheful
moustacheful / koa-passport-auth.js
Last active June 9, 2016 23:00
Koa passport.authenticate wrapper
// koa-passport-authenticate.js
'use strict'
const _ = require('lodash')
const passport = require('koa-passport')
'use strict'
// Middleware wrapper for koa passport to have proper error handling on authenticate.
@gaearon
gaearon / combining.js
Created June 3, 2015 18:03
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
@justmoon
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@webdesserts
webdesserts / Gulpfile.js
Last active April 3, 2023 08:16
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@harperreed
harperreed / peter-thiels-cs183-startup-class-01-notes-essay.md
Created July 29, 2012 21:20
Notes Essays—Peter Thiel’s CS183: Startup—Stanford, Spring 2012

Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.

CS183: Startup—Notes Essay—The Challenge of the Future

Purpose and Preamble