Skip to content

Instantly share code, notes, and snippets.

View georgejecook's full-sized avatar

George Cook georgejecook

View GitHub Profile
@georgejecook
georgejecook / block 1
Last active December 21, 2022 12:54
write unit tests
I make roku apps in Brighterscript. Brighterscript is an extension of the BrightScript language. It adds classes with the class, end class key words, and provides public, protected and private method visibility. It also adds the "@." expression, which transpiles to ".callFunc", so `node@.sayHello(name)`, transpiles to `node.callFunc("sayHello", name)`
please respond with : "ok"
@georgejecook
georgejecook / gist:8acbe9934df85d088f49674a8cd1c24c
Created December 15, 2022 14:47
notes for updating maestro plugin
Based on the provided information, you can modify the updateAsFunctionCalls function as follows to correctly transpile the asString(m.titles[m.video.id].text) call to mc_getString(m, "title." + m.video.id + ".text):
Update the regex in the updateAsFunctionCalls function to also match function calls that include array indexing, such as m.titles[m.video.id]. This can be done by adding \[\] to the regex pattern, so that it looks like this:
Copy code
let regex = /^as(Any|Array|AA|Boolean|Number|Float|Integer|Node|Point|String)(\[\])*/i;
In the getStringPathFromDottedGet function, add a check for array indexing to the while loop that builds up the path parts array. If the current expression is an indexed get expression (isIndexedGetExpression), you can add the index value to the parts array, like this:
Copy code
while (root) {
if (isCallExpression(root) || isCallfuncExpression(root)) {
throw this.getWrongAsXXXFunctionPartError(root);
const path = require('path');
const fs = require('fs-extra');
/*
some roku libraries obfuscate the code in their player.
We can deobfuscate a bunch of the code with these functions
*/
export function Chr(code) {
var num = 0;
if (code.substring(0, 2) === '&H') {
@georgejecook
georgejecook / run-signing-client.ts
Created October 5, 2019 02:02
how do I call run() from command line? this is ts file
import { SigningClient } from './signing-client';
const awsVars = {
awsAccessKey: process.env.AWS_KEY_ID,
awsSecretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
s3BucketName: process.env.S3_BUCKET_NAME,
awsRegion: process.env.AWS_REGION,
assetsHost: process.env.ASSETS_HOST,
zappToken: process.env.ZAPP_TOKEN,
zappPath: 'zapp'
/***********************************************
* Copyright ? Far-Flung Creations Ltd.
* Author: Marius George
* Date: 25 October 2017
* Email: marius@farflunggames.com
* DISCLAIMER: THE SOURCE CODE IN THIS FILE IS PROVIDED ?AS IS? AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL FAR-FLUNG CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) SUSTAINED BY YOU OR A THIRD
@georgejecook
georgejecook / INavigationService.cs
Last active November 7, 2018 10:08
ADVANCED XAMARIN FORMS TECHNIQUES FOR FLEXIBLE AND PERFORMANT CROSS PLATFORM APPS - PART 5, PAGE IN PAGE EMBEDDING.
public interface INavigationServiceProvider
{
/// <summary>
/// Toggles the toolbar visibility
/// </summary>
/// <param name="showing">If set to <c>true</c> showing.</param>
/// <param name="animated">If set to <c>true</c> animate.</param>
void ToggleToolbar (bool showing, bool animated = true);
/// <summary>
using System;
using Xamarin.Forms;
using System.Windows.Input;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.ComponentModel;
using System.Threading.Tasks;
[assembly:
InternalsVisibleTo ("TwinTechsLib.iOS"),
@georgejecook
georgejecook / FastCell.cs
Created May 4, 2015 05:20
butter smooth performance in xamarin forms listview
using System;
using Xamarin.Forms;
namespace TwinEvents.Core.Media.View
{
public class FastCell : ViewCell
{
}
}
@georgejecook
georgejecook / 0_reuse_code.js
Last active August 29, 2015 14:16
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
@georgejecook
georgejecook / gist:3785001
Created September 25, 2012 23:07
this blows up at the method invocation [super.position = position is fine]
- (void)setPosition:(CGPoint)position {
if (self.isInPlasma){
_CCSpriteSetPositionMethod = class_getInstanceMethod([CCSprite class], @selector(setPosition:));
((void(*)(id, SEL, CGPoint))_CCSpriteSetPositionMethod)(self, @selector(setPosition:), ccp(position.x, position.y- 100));
} else {
super.position = position;
}
}