Skip to content

Instantly share code, notes, and snippets.

@StanShumsky
StanShumsky / launch.js
Created September 8, 2016 19:20 — forked from paambaati/launch.js
Debug mocha tests using Visual Studio Code
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Run app.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
@StanShumsky
StanShumsky / functional-utils.js
Created June 16, 2016 14:30 — forked from xgrommx/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)

Keybase proof

I hereby claim:

  • I am stanShumsky on github.
  • I am shumsky (https://keybase.io/shumsky) on keybase.
  • I have a public key whose fingerprint is 2C79 CA84 6A72 30E5 37B8 9856 0FB7 6A57 8715 91F6

To claim this, I am signing this object:

@StanShumsky
StanShumsky / dummydata.js
Created May 26, 2016 09:14 — forked from tfogo/dummydata.js
RESTful API with node.js and mongodb. `npm install` then `node server.js`
var mongoose = require('mongoose')
, Podcast = mongoose.model('Podcast');
Podcast.find({}).remove(function() {
Podcast.create({
title: 'Joe Rogan',
score: 4783,
tags: ['tag1', 'tag2', 'tag3'],
dateSubmitted: new Date
}, {
@StanShumsky
StanShumsky / entry.model.js
Created May 26, 2016 09:13 — forked from notrab/entry.model.js
Walter models
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var validator = require('validator');
var EntrySchema = new Schema({
email: {
type: String,
required: true,
validate: [validator.isEmail, 'invalid email']
},
@StanShumsky
StanShumsky / api.js
Created May 26, 2016 09:12 — forked from tmpjr/api.js
Sample REST server with Node, Mongoose and Express
var express = require('express');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var morgan = require('morgan');
var jwt = require('jsonwebtoken');
var app = express();
var router = express.Router();
var config = require('./config');
var schema = new Schema({
name: String,
binary: Buffer,
living: Boolean,
updated: { type: Date, default: Date.now }
age: { type: Number, min: 18, max: 65 }
mixed: Schema.Types.Mixed,
_someId: Schema.Types.ObjectId,
array: [],
ofString: [String],
@StanShumsky
StanShumsky / position.js
Created May 25, 2016 12:52 — forked from james-gardner/position.js
Mongoose Schemas for Resume
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var PositionSchema = new Schema({
company : String,
position : String,
summary : String,
startDate : Date
});
@StanShumsky
StanShumsky / angular-webpack-cssmodules-example.md
Created March 28, 2016 13:01 — forked from tthew/angular-webpack-cssmodules-example.md
An example of leveraging Webpack, cssmodules (via webpack + postcss) and Angular

A very basic / high-level example of how to use locally scoped cssmodules in Angular, via Webpack using the css-loader.

Read the cssmodules readme and the css-loader README for lots more high-level information. Also checkout the lower-level ICSS (interoperable css) spec/readme for the nitty gritty.

Tl;dr this approach solves many of the same problems BEM sets out to solve

This would require a refactor of existing codebases to use Webpack. But beyond that (which may or may not be trivial depending on many different factors) it appears to be a maintainable and scalable strategy.

Check out this gulp-webpack-angular-seed I put together some time ago as well as the this resume application and this mnutrition branch for examples o

{
"ambientDependencies": {
"angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#64b25f63f0ec821040a5d3e049a976865062ed9d",
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2",
"hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729",
"selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea",
"webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4"
}