Skip to content

Instantly share code, notes, and snippets.

View zeroasterisk's full-sized avatar

alan blount zeroasterisk

View GitHub Profile
@zeroasterisk
zeroasterisk / DateRangePickerWrapper.js
Created September 29, 2016 05:00
react-dates & uniforms = start/stop date range picker glory
import React from 'react';
import { DateRangePicker } from 'react-dates';
import momentPropTypes from 'react-moment-proptypes';
class DateRangePickerWrapper extends React.Component {
constructor(props) {
super(props);
this.state = {
focusedInput: null,
startDate: props.startDate || null,
@zeroasterisk
zeroasterisk / MapEditField.js
Last active September 28, 2016 21:02
React Uniforms Field for a map configuration
import _ from 'lodash';
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { Bert } from 'meteor/themeteorchef:bert';
import React from 'react';
import { BaseField } from 'uniforms';
import UIMapPoly from 'react-map-polygon-selector';
@zeroasterisk
zeroasterisk / buildPhantomJSAsLinux-inDocker.sh
Created September 21, 2016 19:04
Build a node lambda function for
#!/bin/bash
# If you are developing on OSX on Windows
# but you want to run on linux - or in docker - or on AWS Lambda
# PhantomJS must be the binary for that OS...
# https://github.com/sindresorhus/pageres/issues/275
#
# Easiest solution, download inside a docker, running on linux
#
# This script should be run from within the docker container
#
@zeroasterisk
zeroasterisk / DockerfileForBundle
Created July 29, 2016 17:01
Meteor build -> Docker (custom image, from bundle)
FROM node:4.4.7-slim
MAINTAINER Alan Blount <[email protected]>
RUN npm install -g npm@3 pm2 \
&& npm cache clear
# TODO: remove when https://github.com/npm/npm/issues/9863 is fixed
RUN cd $(npm root -g)/npm \
&& npm install fs-extra \
&& sed -i -e s/graceful-fs/fs-extra/ -e s/fs\.rename/fs.move/ ./lib/utils/rename.js
@zeroasterisk
zeroasterisk / MyRequestInviteContainer.js
Last active May 5, 2016 21:42
redux-form validate functions passed into component
import { Meteor } from 'meteor/meteor';
import { Email } from 'meteor/email';
import { createContainer } from 'meteor/react-meteor-data';
import { Texts } from '../../../api/Texts/collection';
import { Users } from '../../../api/Users/collection';
import { schemaInviteRequest, sendInviteRequest } from '../../../api/Invites/methods';
import { Bert } from 'meteor/themeteorchef:bert';
@zeroasterisk
zeroasterisk / formza.js
Created April 19, 2016 21:26
React friendly utility to get a data object from a form onSubmit event
/**
* TEMP WIP Form helper utilities
*
*/
import _ from 'lodash';
export function getOptions(options) {
return _.extend(
{
@zeroasterisk
zeroasterisk / _service.md
Created February 5, 2016 14:43 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
// Subscriptions automatic helpers
autoSub = { readys: {}, managers: {} };
autoSubscribe = function(T, subKey, paramKey) {
T.onCreated(function() {
var self = this;
if (!_.has(autoSub.managers, subKey)) {
autoSub.managers[subKey] = new SubsManager();
}
if (!_.has(autoSub.readys, subKey)) {
autoSub.readys[subKey] = new ReactiveVar();
@zeroasterisk
zeroasterisk / darren-pluck.php
Created July 6, 2015 14:59
[KyOSS Discuss] Help with PHP - using values in indexed array to traverse multi-dimensional array
<?php
/**
* pluck out a value from a nested array, based on a $path
* where $path is a single-dim list of keys.
*
* @param array $form (multi-dim)
* @param array $path (single dim)
* @reutrn mixed $value from $form, in $path
@zeroasterisk
zeroasterisk / nginx_partial.conf
Created June 26, 2015 01:48
nginx config (partial) caching reverse proxy example
# ----------------------------¬
# Proxy config/example
# (optional config used inside server/location blocks)¬
# context - server, location¬
# link: http://wiki.nginx.org/HttpProxyModule#proxy_cache¬
# link: http://nginx.org/en/docs/http/ngx_http_proxy_module.html¬
# link: http://nginx.org/en/docs/http/ngx_http_upstream_module.html
# link: http://www.packtpub.com/article/using-nginx-reverse-proxy¬
# ----------------------------¬