Skip to content

Instantly share code, notes, and snippets.

View rymawby's full-sized avatar

Ry Mawby rymawby

View GitHub Profile
@rymawby
rymawby / git-remove-last-commit.sh
Created January 18, 2017 08:45
Git - remove last commit
git reset HEAD~ --hard
@rymawby
rymawby / https-rourltransfer.brs
Created December 5, 2016 09:56
Loading data over https using Brightscript and roUrlTransfer
if url.inStr(0, "https") = 0
urlTransfer.setCertificatesFile("common:/certs/ca-bundle.crt")
urlTransfer.initClientCertificates()
end if
@rymawby
rymawby / brightscript-minikeyboard.xml
Created December 5, 2016 09:25
Brightscript MiniKeyboard example
<MiniKeyboard
id = "keyboard"
keyboardBitmapUri="pkg:/images/hd/keyboard.png"
keyColor="0xffffff"
focusedKeyColor="0xffffff"
lowerCase="false"
/>
@rymawby
rymawby / DupeChecker.brs
Last active November 28, 2016 09:40
Brightscript string dupe checker
function DupeChecker() as Object
this = {}
this.dupes = []
this.addItem = function(item as String, isPrintOnFoundDupe = false as Boolean) as Boolean
isDupe = m.checkIsDupe(item)
m.dupes.push(item)
if isPrintOnFoundDupe then
print item
end if
@rymawby
rymawby / scenegraph-rcu-handling.markdown
Last active November 13, 2016 22:41
Roku SceneGraph RCU handling

#Working with RCU input SceneGraph makes working with RCU events easier than ever. Currently in SDK1 you generally would have an event loop for a page and listen for RCU inputs - then check what item is focused before deciding what to do with the input. With SceneGraph you put the code directly on the component/node.

The function used for handling RCU input is function onKeyEvent(key as String, press as Boolean) as Boolean.

The key that is passed in will be one of these strings, representing an RCU input: back, up, down, left, right, OK, replay, play, rewind, fastforward or options. Keys such as home are handled by the Roku firmware and are unavailable to us. The press parameter is true if the input was a press and false if it was a release. Allowing us to avoid apparent double clicks.

These key events can be bubbled up through the display hierarchy. If we do not wish the event to be bubbled up (because we have handled the event) we return true. If however we didn't handle t

@rymawby
rymawby / search-all-git-commits.sh
Created November 10, 2016 04:55
Search all git commits for a search string
git log -S 'search for me' --source --all
@rymawby
rymawby / scenegraphDay1.markdown
Last active January 9, 2022 23:53
SceneGraph Training - getting an application up and running

#Setting up a SceneGraph application

##Task objective: Set up a SceneGraph application with correct directory structure and get it running on the box.

The way SceneGraph applications are set up with regards to directory structure are different than previous SDK1 applications.

Have a read of the information here: https://sdkdocs.roku.com/display/sdkdoc/Developing+Scene+Graph+Applications

Basically you have your directory structure like this:

@rymawby
rymawby / git-branches-by-commit-date.sh
Created June 27, 2016 14:36 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@rymawby
rymawby / padawan-to-jedi-extract-method-refactoring-technique.md
Created May 5, 2016 10:30
Padawan to Jedi: Extract Method refactoring technique

Refactor the following using the "Extract Method" technique.

function welcomeToTakodanaCastle()
{
  while _guests.hasNext()
  {
    guest = _guests.next();
    if(guest.isSmuggler)
 {
@rymawby
rymawby / pr-comment-styles.txt
Created April 12, 2016 13:32
PR comment styles for GitLab closing tickets
Refs #{ticket}: {description}
Closes: #{ticket}: {description}
Fix #{ticket}: {description}