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)
@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

@StanShumsky
StanShumsky / introrx.md
Created November 25, 2015 07:47 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
/**
* @ngdoc directive
* @name ng.directive:ngApp
*
* @element ANY
* @param {angular.Module} ngApp an optional application
* {@link angular.module module} name to load.
*
* @description
*