Skip to content

Instantly share code, notes, and snippets.

View qmacro's full-sized avatar

DJ Adams qmacro

View GitHub Profile
@qmacro
qmacro / gist:4493660
Created January 9, 2013 14:47
Whitespace at the start of an array causes the parse of that array to be erroneous. Note the space between [ and { on line 32.
report ydj_json_test.
types:
begin of ty_favcolour
, name type string
, colour type string
, end of ty_favcolour
.
types:
@qmacro
qmacro / gist:5517150
Created May 4, 2013 10:56
Deliberately step-by-step, exploring FP in Python. names.txt contains lines like this: "MARY","PATRICIA","LINDA","BARBARA" "ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET" "DOROTHY","LISA" "NANCY" "KAREN","BETTY","HELEN" etc
import itertools
import operator
print reduce(
operator.add,
map(
lambda n: (n[0]+1) * n[1],
enumerate(
map(
lambda name: reduce(
@qmacro
qmacro / gist:6199968
Created August 10, 2013 10:39
#YRS2013 Hacks On Github - code to retrieve commit counts from Github API and store in a Google spreadsheet
// 0-indexed columns
COMMITS = 3;
GITHUBREPO = 2;
TOKEN = "";
function main() {
TOKEN = ScriptProperties.getProperty("githubtoken");
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheetByName("Hacks");
@qmacro
qmacro / gist:6199973
Last active October 3, 2021 20:19
SheetAsJSON - expose a Google spreadsheet (with a header row) as JSON - See https://qmacro.org/2013/10/04/sheetasjson-google-spreadsheet-data-as-json/ for a writeup
function doGet(request) {
var output = ContentService.createTextOutput();
var data = {};
var id = request.parameters.id;
var sheet = request.parameters.sheet;
var ss = SpreadsheetApp.openById(id);
data["records"] = readData_(ss, sheet);
var callback = request.parameters.callback;
if (callback == undefined) {
output.setContent(JSON.stringify(data));
@qmacro
qmacro / index.html
Last active February 21, 2017 06:49
sap.m.Column demandPopin property
<!DOCTYPE HTML>
<html>
<head>
<meta name="description" content="demandPopin example" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>3431071</title>
<script id="sap-ui-bootstrap"
itembinding.filter(
new sap.ui.model.Filter([
new sap.ui.model.Filter([
new sap.ui.model.Filter("Category", "EQ", "AC"),
new sap.ui.model.Filter("Category", "EQ", "PR")
], false),
new sap.ui.model.Filter([
new sap.ui.model.Filter("SupplierName", "EQ", "Red Point Stores"),
new sap.ui.model.Filter("SupplierName", "EQ", "Technocom")
], false),
@qmacro
qmacro / index.html
Last active June 26, 2019 13:11
Custom Sorter and Grouper in SAPUI5
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>test</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='https://sapui5.hana.ondemand.com/sdk/resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.m'></script>
@qmacro
qmacro / calendarinviter.js
Created January 2, 2014 13:50
Calendar Inviter
CALENDAR = "Work";
EVENT_MATCH = /^SAP\s/;
GUEST_LIST = ['you-1@example.com', 'you-2@example.com'];
DATE_FROM = new Date('01 Jan 2014');
DATE_TO = new Date('31 Dec 2014');
FORCE_ADD = false;
function main() {
inviteMe(CALENDAR, DATE_FROM, DATE_TO, EVENT_MATCH, GUEST_LIST, FORCE_ADD);
}
@qmacro
qmacro / CheckboxColumnBinding.html
Created February 4, 2014 08:34
Checkbox and Column Visibility binding
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>Checkbox and Column Binding</title>
<script id="sap-ui-bootstrap"
type="text/javascript"
@qmacro
qmacro / 0_reuse_code.js
Created March 9, 2014 18:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console