Skip to content

Instantly share code, notes, and snippets.

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
/**
* The onOpen function runs automatically when the Google Docs document is
* opened. Use it to add custom menus to Google Docs that allow the user to run
* custom scripts. For more information, please consult the following two
* resources.
*
* Extending Google Docs developer guide:
* https://developers.google.com/apps-script/guides/docs
*
* Document service reference documentation:
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
</style>
</template>
<script>
@rachelslurs
rachelslurs / designer.html
Created September 26, 2014 03:12
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<polymer-element name="my-element">
def defineSenatorTrack() =
{
// for every committee
committeeIssueSenatorMap.foreach( committee => {
committee._2.foreach(issueConf => {
issueConf._2.foreach( senator => {
val max = committee._2.foldLeft(0)( (result, current) => result + current._2.filter(_.faction.name.equalsIgnoreCase(senator.faction.name)).size) / 2
// does the senator fit in subcommittee 1
if(doesSenatorFitInSubCommittee(senator.faction.name, max, senator, committee._1.name,SUBCOMMITTEE_1_KEY)) {
// add
@rachelslurs
rachelslurs / Vertical and horizontal center, change width on scroll.markdown
Created July 26, 2015 22:36
Vertical and horizontal center, change width on scroll
@rachelslurs
rachelslurs / post-issues-bookmarklet.js
Last active June 18, 2016 19:11
Post and Issue Dummy Images Bookmarklet
javascript:(function() {
var a = document.getElementById('_post_meta_image_alt_text_0');
if (a) {
a.value = 'Some alt text';
}
var b = document.getElementById('_post_meta_image_desktop_0');
if (b) {
b.value = 'https://placehold.it/1400x600/003003/ffffff';
}
var c = document.getElementById('_post_meta_image_desktop_mobile_tile_0');
@rachelslurs
rachelslurs / gravity_forms_ugh.php
Last active March 30, 2017 04:19
This is all work I did when I was thinking we were going to use the gravity forms awful markup
/**
* Filters the next, previous and submit buttons.
* Replaces the forms <input> buttons with <button> while maintaining attributes from original <input>.
*
* @param string $button Contains the <input> tag to be filtered.
* @param object $form Contains all the properties of the current form.
*
* @return string The filtered button.
*/
add_filter( 'gform_next_button', 'input_to_button', 10, 2 );
@rachelslurs
rachelslurs / CountriesContainer.js
Last active July 31, 2017 22:29
Passing a Redux-Form action creator from container to component via React context
import React, {Component} from 'react'
import {connect} from 'react-redux'
import PropTypes from 'prop-types'
import {reduxForm, change} from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
class CountriesContainer extends Component {
static propTypes = {
changeFieldValue: PropTypes.func.isRequired
}
@rachelslurs
rachelslurs / CountriesContainer.js
Created August 1, 2017 15:03
Passing a Redux-Form action creator from container to component via React context
import React, {Component} from 'react'
import {connect} from 'react-redux'
import PropTypes from 'prop-types'
import {reduxForm, change} from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
class CountriesContainer extends Component {
static propTypes = {
changeFieldValue: PropTypes.func.isRequired
}