Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / sample-app
Created November 26, 2015 21:27 — forked from fideloper/sample-app
Sample application Upstart script, using Forever
#!/bin/bash
# Sample App Init script for running sample app daemon
#
# chkconfig: - 98 02
#
# description: Sample Application Upstart, using Forever
APPHOME=/opt/sample-app
APPSCRIPT=app.js
@veggiemonk
veggiemonk / index.html
Created November 29, 2015 21:14 — forked from anonymous/index.html
Mithril experiment mithriljs: Mithril template // source http://jsbin.com/radaze
<!DOCTYPE html>
<html>
<head>
<title>Mithril experiment</title>
<meta name="description" content="mithriljs: Mithril template">
<meta charset="utf-8">
<script>
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
var Modal = {
controller: function() {
return {isVisible: false} //internal state
},
view: function() {
return m(".modal", {
class: ctrl.visible ? ".modal-visible" : "" //sets visibility via CSS
config: function(el, init) {
if (!init) {
//jQuery-exposed API
@veggiemonk
veggiemonk / index.html
Created November 30, 2015 17:04 — forked from anonymous/index.html
JS Bin unique routes for page with/without overlay // source http://jsbin.com/zutisu
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="unique routes for page with/without overlay">
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.min.js"></script>
<style id="jsbin-css">
div.overlay {
position: absolute;

FlattenDeep

This module can be used to flatten a deeply nested array.

Example

Deeply nested array

import flattenDeep from 'flattenDeep'
@veggiemonk
veggiemonk / ajax-loader.scss
Created December 15, 2015 09:04 — forked from gilbert/ajax-loader.scss
Global Mithril.js AJAX Loader
// Taken from http://loading.io/
uiload {
display: inline-block;
position: relative;
& > div {
position: relative;
}
}
@-webkit-keyframes ajax-loader {
@veggiemonk
veggiemonk / validate_date.js
Created December 16, 2015 12:36
date input manipulation
/**
*
* @param date {string}
* @returns {string || null}
*/
function validateDate (date) {
var dateError = false;
//console.log("VALIDATE DATE = "+ date)
if (date) {
var sDate = date.split(/[.,\/ -]/);
@veggiemonk
veggiemonk / app.js
Created December 17, 2015 12:15 — forked from peteruithoven/app.js
Rehydrating Redux store when using systemjs hot reloader
import {createStore} from 'redux';
import reducer from './reducers/index.js'
import { rehydrate, rehydratingStore } from './utils/rehydratingStore.js';
const store = rehydratingStore()(createStore)(reducer);
export function __reload(deletedModule){
const prevState = deletedModule.getState();
debug('Reloaded. rehydrate with state: ', prevState.sketcher.objectsById);
store.dispatch(rehydrate(prevState));
@veggiemonk
veggiemonk / echoServer.js
Created April 20, 2016 07:40
Node.js ECHO server utility to test front-end code depending on the server response.
'use strict';
/**
* HELP! I am not the author of this, I don't remember where I got this file, it was in es5 at the time.
* If you know who the author is, please get in touch with me to set the record straight.
* Thank you and thank to the anonymous original author!
*/
const VERSION = '0.1.0';
# Node
## Install n
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y git
sudo chown -R veggiemonk:veggiemonk /usr/local
git clone https://github.com/tj/n.git ~/code/n
cd ~/code/n && make install
n 5.9.1
npm -g i diff-so-fancy npm pure-prompt npm-check caniuse-cmd