Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / index.html
Created November 17, 2015 10:38 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/secaq
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script src="https://rawgit.com/lhorie/mithril.js/next/mithril.js"></script>
<script id="jsbin-javascript">
// noprotect
@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));
#!/bin/sh
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mExecuting command $@ for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -maxdepth 4 -type d -name ".git" | cut -c 3-) ; do