View gist:97c66b187db2ac8ecebaef535750a76b
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user
View strip.string.js
var strip = function(string, characters) {
if(!characters) {
if(typeof String.prototype.trim !== undefined) {
// Simply use the String.trim as a default
return String.prototype.trim.call(string);
} else {
// set characters to whitespaces
characters = "\s\uFEFF\xA0";
}
}
View node-rm-rf-async.js
var fs = require('fs');
var rmdirAsync = function(path, callback) {
fs.readdir(path, function(err, files) {
if(err) {
// Pass the error on to callback
callback(err, []);
return;
}
var wait = files.length,
count = 0,
View node-rm-rf.js
var fs = require('fs');
var deleteFolderRecursive = function(path) {
if( fs.existsSync(path) ) {
fs.readdirSync(path).forEach(function(file,index){
var curPath = path + "/" + file;
if(fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
View html4-change-input.html
<!-- index.html -->
<input id='abc'/>
<script>
var input = document.getElementById('abc');
input.addEventListener('change', function(event) {
// .. only triggers on input loss of focus
});
input.addEventListener('keyup', function(event) {
// .. triggers on any keyboard interaction
View designer.html
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="ss-message">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
View vagrant-scp
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
SERVER=localhost
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} $FILE vagrant@$SERVER:$PATH
View remove-known-hosts.sh
# ssh-keygen -R hostname [-f known_hosts_file]
# ssh-keygen -r hostname [-f input_keyfile] [-g]
#e.g.
ssh-keygen -R 192.168.99.99
ssh-keygen -R mytestdomain.vagrant
View dw-js-frame-bust
if (top.location != self.location) {
top.location = self.location.href;
}
View js-frame-bust
if(top != self) {
top.onbeforeunload = function() {};
top.location.replace(self.location.href);
}