Skip to content

Instantly share code, notes, and snippets.

@rdepena
rdepena / snapShotWithPreview.js
Created October 4, 2018 14:43
Takes a snapshot and previews in a child window.
(async () => {
try {
const image = await fin.Window.getCurrentSync().getSnapshot({
height: 100,
width: 100,
x: 10,
y: 10,
});
const res = await fetch(`data:image/png;base64,${image}`);
@rdepena
rdepena / download.js
Created June 19, 2017 04:06
Example scheduling a download
function downloadRuntime(delayInMinutes) {
const downloadOptions = {
//Specific version number required, if given a release channel the call will produce an error.
version: '6.49.21.9'
};
setTimeout(() => {
fin.desktop.System.downloadRuntime(downloadOptions, progress => {
document.open();
@rdepena
rdepena / whatis.sh
Created May 23, 2017 21:35
Script that prints the point version given a release channel
#!/bin/bash
curl -s https://cdn.openfin.co/release/runtime/$1 | grep .
## usage:
## > ./whatis.sh beta
## 6.49.20.21
@rdepena
rdepena / of-template.sh
Created May 4, 2017 19:15
my oftemplate command.
#!/bin/bash
git clone git@github.com:rdepena/of-template.git $1 && cd $1 && npm install
# in .zshrc:
#alias oftemplate='~/Documents/Projects/of-template-getter/of-template.sh'
@rdepena
rdepena / cmusm.sh
Last active May 12, 2016 13:03
Shortcut for launching cmus and media key support as one.
#!/bin/sh
# This scripts starts up cmus with media key support.
# Project cmus-mediakeys only works under node 0.10
# So we need nvm.
# https://github.com/creationix/nvm
source ~/.nvm/nvm.sh
nvm use 0.10
# now we can launch the node mediakeys app and cmus.
@rdepena
rdepena / CoreCrash.cs
Last active October 16, 2015 15:35
Notification on Core Crash
using System;
using Openfin.Desktop;
using Newtonsoft.Json.Linq;
class Program
{
static void Main()
{
//These are the OpenFin Runtime Optons.
var runtimeOptions = new RuntimeOptions {
@rdepena
rdepena / Program.cs
Last active August 29, 2015 14:21
Super Simple OpenFin Connection
using System;
using Openfin.Desktop;
using Newtonsoft.Json.Linq;
namespace SimpleConnection
{
class Program
{
static void Main()
{
@rdepena
rdepena / gulpfile.js
Created December 29, 2014 18:43
Gulp recipe for the OpenFin toolkit.
var gulp = require('gulp'),
openfinConfigBuilder = require('openfin-config-builder'),
openfinLauncher = require('openfin-launcher'),
path = require('path');
function createConfig() {
return openfinConfigBuilder.create({
startup_app: {
name: 'myApp',
url: 'http://openfin.co'
@rdepena
rdepena / mac_keyboard_windows_mapping.ahk
Created December 16, 2014 21:31
Mapping that switches the control and command keys for using Mac keyboards in Windows.
#z::Run www.autohotkey.com
^!n::
IfWinExist Untitled - Notepad
WinActivate
else
Run Notepad
return
LWin::LCtrl
@rdepena
rdepena / promisesPlayground.js
Last active August 29, 2015 14:05
Promises playground
//we will look at promises, they are a different way to do asynchronous and part of ES6 (available in chrome 35).
//we will need to create plenty of asynk functions to see promises in use,
//so this decorator makes functions asynkish.
var asynkify = function (func) {
return function () {
var delay = Math.floor(Math.random() * 2000),
args = Array.prototype.slice.call(arguments, 0);
setTimeout(function (){