Skip to content

Instantly share code, notes, and snippets.

View gregorskii's full-sized avatar

Greg gregorskii

  • Los Angeles, California
View GitHub Profile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Simple Provisioner
$script = <<SCRIPT
SCRIPT
Vagrant.require_version '>= 1.5.1'
@gregorskii
gregorskii / browerSyncProxyMiddleware.js
Created April 30, 2016 20:46
Proxy Middleware example
import proxyMiddleware from 'http-proxy-middleware';
config.browserSyncConfig = {
proxy: {
target: '<DEST SITE>',
middleware: [proxyMiddleware(['<API PATH>'], {target: '<API TARGET>'})]
}
};
plugins.browserSync.init(config.browserSyncConfig);
@gregorskii
gregorskii / example.js
Last active May 1, 2016 00:19
nodemon as a gulp task
'use strict';
import {gulp, plugins, config} from '../plugins';
import proxyMiddleware from 'http-proxy-middleware';
const proxy = 'localhost:8002';
/**
* Watch Task: gulp watch
*/
gulp.task('watch', plugins.sequence('nodemon', 'bundle', 'browserSync', 'watch-start'));
@gregorskii
gregorskii / facebook-scraper.conf.j2
Last active May 4, 2016 23:35
Enable Facebook Scrapers on NGINX using Ansible (Trellis Example) Per https://gist.github.com/ifnull/1ac3d9a20d827972d581be6d5ade96eb
# trellis/roles/nginx/templates/facebook-scraper.conf.j2
satisfy any;
allow 204.15.20.0/22;
allow 69.63.176.0/20;
allow 66.220.144.0/20;
allow 66.220.144.0/21;
allow 69.63.184.0/21;
allow 69.63.176.0/21;
allow 74.119.76.0/22;
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
@gregorskii
gregorskii / 0_reuse_code.js
Created August 1, 2016 16:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gregorskii
gregorskii / auth.js
Created March 25, 2017 21:28
Mongoose promise based object creation and validation
const email = req.body.email;
const password = req.body.password;
const query = UserModel.findOne({ email });
query.exec()
.then((existingUser) => {
if (existingUser) {
logger.info('user found');
return res.status(422).send({ error: 'Email in use' });
}
@gregorskii
gregorskii / mongoose.js
Created March 25, 2017 21:29
Mongoose Interface Promise Based
import mongoose from 'mongoose';
import Promise from 'bluebird';
import logger from './logger';
const gracefulShutdown = (reason, done) => {
mongoose.connection.close(() => {
logger.info(`Mongoose default connection disconnected through ${reason}`);
done();
});
};