Skip to content

Instantly share code, notes, and snippets.

set windowTitle to ""
set currentTabTitle to ""
set appID to ""
set appName to ""
set comments to ""
set wins to ""
set anyFinderWindowVisible to false
tell application "System Events"
set frontApp to first application process whose frontmost is true
set windowTitle to ""
set currentTabTitle to ""
set appID to ""
set appName to ""
set comments to ""
set wins to ""
set anyFinderWindowVisible to false
set anyVisibleWindow to anyVisibleWindow()
tell application "System Events"
set windowTitle to ""
set currentTabTitle to ""
set appID to ""
set appName to ""
set comments to ""
set visWins to totalVisibleWindows()
tell application "System Events"
set frontApp to first application process whose frontmost is true
set appName to name of frontApp
'use strict';
var $ = require('nodobjc');
// Load the AppKit framework.
$.framework('AppKit');
// Create delegate that gets notified
var Delegate = $.NSObject.extend('Delegate');
@bhavyaw
bhavyaw / Untitled-1
Created November 26, 2016 11:43
Promises Child Workflow Example
console.clear();
var myAwesomePromise = new Promise((resolve,reject) => {
setTimeout(() => {
resolve("Timeout - 2000 promise is resolved");
},2000);
});
var resolvedPromise = Promise.resolve("This is a resolved promise");
@bhavyaw
bhavyaw / utils.service.ts
Created March 16, 2017 09:33
Minutes to HH:mm
formatMinutesToDuration(durationInMinutes){
let formattedDuration = ``;
if(durationInMinutes){
let derivedHours = round( (durationInMinutes / 60 ),3);
let hours = Math.trunc(derivedHours);
let derivedMinutes = Math.abs(derivedHours - Math.floor(derivedHours));
let minutes = Math.trunc(derivedMinutes * 60);
let hoursFormatted = hours ? ( (hours < 10) ? `0${hours}` : hours ) : "00";
let minuteFormatted = minutes ? ( (minutes < 10) ? `0${minutes}` : minutes ) : "00";