Skip to content

Instantly share code, notes, and snippets.

@lightman76
lightman76 / ScriptLab.yaml
Created August 19, 2023 05:27
Can delete an editable contentControl in Word Online
name: Blank snippet
description: Creates a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: |
var counter = 1;
Word['run'](async function (context) {
let doc = context.document;
let endOfBodyRange = doc.body.getRange(Word.RangeLocation.end);
@lightman76
lightman76 / ScriptLab.yml
Last active August 19, 2023 05:23
Cannot delete an uneditable contentControl in Word Online
name: Delete a read-only content control
description: trying to demo a bug
host: WORD
api_set: {}
script:
content: |
var counter = 1;
Word['run'](async function (context) {
let doc = context.document;
let endOfBodyRange = doc.body.getRange(Word.RangeLocation.end);
@lightman76
lightman76 / ScriptLab.yml
Created August 19, 2023 04:46
Scriptlab demo of Word Online Content Control Issues
name: Insertion order test
description: trying to demo a bug
host: WORD
api_set: {}
script:
content: |
var counter = 1;
Word['run'](async function (context) {
var doc = context.document;
var ccs = doc.contentControls.getByTag("EXAMPLE_TAG1");
name: Blank snippet
description: Create a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
@lightman76
lightman76 / attributes.rb
Created August 25, 2016 15:01
Proposed modification to the attribute? method of the attributes module to use the unobservable_read_attribute when available
def attribute?(key)
# this method is used only for conditional type access.
# When included on an object with read observations, don't count this as an observable read
if respond_to? :unobservable_read_attribute
value = unobservable_read_attribute key
else
value = read_attribute key
end
return false if value.nil?
@lightman76
lightman76 / names_substitions_suppression_spec.rb
Created August 25, 2016 13:56
Failing spec for citeproc-ruby: Variables used only in conditionals inside of names->substitions are suppressed
# -*- coding: utf-8 -*-
require 'spec_helper'
module CiteProc
module Ruby
describe "Renderer#render_names" do
let(:renderer) { Renderer.new }
@lightman76
lightman76 / google_contacts_api.rb
Last active August 8, 2017 10:40
Class to interface with Google Contacts API in Ruby. Adapted from https://gist.github.com/cantino/d1a63045fbfe5fc55a94 . Initialize the class with client which is a hurley client and auth is a Signet::OAuth2::Client - I'm using the versions from the google-api-ruby-client 0.9.x series. Hurley client can be one created straight up or prebuilt fro…
#Adapted from https://gist.github.com/cantino/d1a63045fbfe5fc55a94
module ContactList
class GoogleContactsApi
MAX_RESULTS = "250"
attr_reader :client
def initialize(client, auth)
@client = client
@lightman76
lightman76 / backbone-rivets.config.js
Last active December 13, 2015 19:49 — forked from wulftone/backbone-rivets.config.js
New to backbone and rivets - but in my initial experiments I noticed problems around collections and models with collection attributes. Think this version of the adapter better handles those than the original. I did see where someone posted that beyond trivial examples one should bind to the collection directly versus handling it directly under …
rivets.configure({
adapter:{
subscribe:function (obj, keypath, callback) {
if (obj instanceof Backbone.Collection) {
obj.on('add remove reset', function () {callback(obj);});
} else if(obj.get(keypath) instanceof Backbone.Collection) {
obj.get(keypath).on('add remove reset', function (m,v) {callback(obj.get(keypath));});
} else {
obj.on('change:' + keypath, function (m, v) {callback(v)});
}