Skip to content

Instantly share code, notes, and snippets.

View yattias's full-sized avatar

Kobe Attias yattias

View GitHub Profile
@yattias
yattias / webpack.config.prod.js
Created July 10, 2018 21:08
Sample webpack config for prod
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const settings = require('./settings');
module.exports = {
entry: [
'./src/client/index'
],
@yattias
yattias / webpack.config.dev.js
Created July 10, 2018 21:06
Sample standard dev config for webpack
const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const settings = require('./settings');
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: [
'./src/client/index'
],
// Drops all mongo collections associated with a test Database before running any tests.
process.env.NODE_ENV = 'test';
import mongoose from 'mongoose';
import settings from '../../src/config/settings';
before(async function(){
const dropCollection = (name) => {
return new Promise(function(resolve, reject){
@yattias
yattias / gulp_flatten_paths.js
Created September 15, 2017 20:25
Utility function to flatten an object with varied inner structure (Array, Object, string) into one flat array
// Utility function to flatten an object with varied inner structure.
// Particularly useful in gulp when setting up a watch to listen for any file change.
// Arbitrary file path object
const paths = {
module1: {
js: [
'src/app/**/*.js',
'some_package/foo.js',
'some_package/bar.js',
@yattias
yattias / reserve_hold
Created October 29, 2012 23:26
Converting an hold on an inventory item to a reservation
<?php
/**
* @author K0b3
* Makes a service request to reservations api in order to create a reservation
* @param <int> $hold_id
* The hold ID to be upgraded to a reservation
* @param <int> $order_group_id
* The order group which the hold is part of
* @param <int> $customer_id
@yattias
yattias / service_wrapper
Created November 17, 2011 14:49
A very good function for executing service calls
<?php
/* @author: K0b3 Attias
* Executes a services call to a specific endpoint using curl with a number of options
* TODO: Modify the params to be a single object with multiple options
* @since 09/02/11
* @param <string> $service: The service to execute the call on (defined as a constant in one of the includes files)
* @param <string> $method: The method that will be called on the service (defined as a constant in one of the includes files)
* @param <string> $http_method: HTTP method
* @param <array> $params: Params which will be passed to the endpoint