Skip to content

Instantly share code, notes, and snippets.

View qmacro's full-sized avatar

DJ Adams qmacro

View GitHub Profile
@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"
@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 / 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: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: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:3999375
Created November 2, 2012 08:00
GoogleAppsScript ROT functions
var alphabet = 'abcdefghijklmnopqrstuvwxyz';
function rotText(text, n) {
var newText = "";
for (var i = 0, j = text.length; i < j; i++) {
newText += rot(text[i], n);
}
return newText;
}
@qmacro
qmacro / conditionaldatabinding.html
Created May 25, 2012 13:26
SAPUI5 Conditional Databinding
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>SAPUI5 Conditional Databinding</title>
<script src="resources/sap-ui-core.js"
type="text/javascript"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_goldreflection">
</script>
@qmacro
qmacro / yrequestbin
Created May 17, 2012 15:17
ABAP wrapper for http://requestb.in in a 'release early release often' stylee
class YREQUESTBIN definition
public
final
create public .
public section.
*"* public components of class YREQUESTBIN
*"* do not include other source files here!!!
data NAME type STRING .
@qmacro
qmacro / gist:2589735
Created May 3, 2012 21:42
Revealing the embedded jQuery 1.6.2 in an SAP NetWeaver Gateway system (2.0 SP03)
class ZCL_DJ0 definition
public
inheriting from /IWCOR/CL_DS_HDLR_DEBUG
final
create public .
public section.
class-methods RUN .
protected section.
@qmacro
qmacro / basecamp_todos.coffee
Created February 23, 2012 22:47
Hubot script: Basecamp Todos
# Basecamp todos
# Reports a count of the person's outstanding todo items per todo list.
# Uses bcapi.coffee (coming soon!)
# (Don't forget to set the HUBOT_BASECAMP_KEY and HUBOT_BASECAMP_URL)
bcapi = require '../src/bcapi'
module.exports = (robot) ->
robot.hear /my todo(s| item)?/i, (msg) ->
basecamp_users msg, (people) ->