Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Zephyros
Search
Daniele Polencic
August 28, 2013
Technology
1
280
Zephyros
The OS X window manager for hackers
Daniele Polencic
August 28, 2013
Tweet
Share
More Decks by Daniele Polencic
See All by Daniele Polencic
Zero to Kubernetes — Developer's Gym Singapore
danielepolencic
2
190
Scaling Microservices with Message Queues, Spring Boot and Kubernetes
danielepolencic
3
360
7 tips and tricks on how to make the most of your Kubernetes journey
danielepolencic
3
270
Deploying and Scaling Spring Boot Microservices to Amazon EKS
danielepolencic
1
630
From Zero to Forex Trading Bot Hero with Node.js and Typescript
danielepolencic
0
350
Kubernetes Chaos Engineering: Lessons Learned in Networking
danielepolencic
0
200
Deploying and Scaling Spring Boot Microservices to Kubernetes
danielepolencic
0
70
Scaling Machine Learning in the Cloud with Kubernetes
danielepolencic
0
71
From Zero to Forex Trading bot Hero
danielepolencic
0
120
Other Decks in Technology
See All in Technology
スプリントゴールで価値を駆動しよう
takufujii
3
1.6k
“新卒らしさ”を脱ぎ捨てて 〜1年を経て学んだこと〜
rebase_engineering
0
130
Azure Developer CLI と Azure Deployment Environment / Azure Developer CLI and Azure Deployment Environment
nnstt1
1
120
アプリケーションの中身が見える!Mackerel APMの全貌と展望 / Mackerel APMリリースパーティ
mackerelio
0
420
AIの電力問題を概観する
rmaruy
1
210
Rebase エンジニアリング組織の現状とこれから
rebase_engineering
0
140
Redmineの意外と知らない便利機能 (Redmine 6.0対応版)
vividtone
0
1.1k
Okayama WordPress Meetup #12 | そのバックアップ、本当に復元できますか? リストアやってみた!
takeshifurusato
0
110
FastMCPでSQLをチェックしてくれるMCPサーバーを自作してCursorから動かしてみた
nayuts
1
180
AIのための オンボーディングドキュメントを整備する - hirotea
hirotea
9
2.3k
継続戦闘能⼒
sansantech
PRO
0
210
Oracle Cloud Infrastructure:2025年5月度サービス・アップデート
oracle4engineer
PRO
0
350
Featured
See All Featured
A Tale of Four Properties
chriscoyier
159
23k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Code Review Best Practice
trishagee
68
18k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Facilitating Awesome Meetings
lara
54
6.4k
Designing for humans not robots
tammielis
253
25k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
The World Runs on Bad Software
bkeepers
PRO
68
11k
Docker and Python
trallard
44
3.4k
Building Adaptive Systems
keathley
41
2.6k
Faster Mobile Websites
deanohume
307
31k
Transcript
Zephyros
The OS X window manager for hackers
DEMO
Adapters
Adapters
None
1 zephyros.bind('t', ['Cmd', 'Shift'], function(err){ 2 zephyros.getFocusedWindow(function(window){ 3 zephyros.getWindowFrame(window.id, function(window){
4 zephyros.setFrame({ 5 id: window.id, 6 frame: {x: 0, y:0, w: 200, h: 300} 7 }); 8 }); 9 }); 10 }); Callback hell
Functional Javascript
3 concepts • Lazy Chains • Promises • Mixins
Lazy Chains 1 new LazyChain([2,1,3]) 2 .invoke('concat', [8,7,6]) 3 .invoke('sort')
4 .invoke('join', ' ') 5 .force(); 6 7 // 1 2 3 6 7 8
Promises 1 asyncCall() 2 .then(function(data1){ 3 // do something... 4
return anotherAsyncCall(); 5 }) 6 .fail(function(err) { 7 // handle any error resulting from any of 8 the above calls 9 }) 10 .done();
Mixins 1 var RectangleClickButton = function(w, h, text, callback) {
2 ... 3 }; 4 5 _.extend(RectangleClickButton.prototype, rectangle); 6 _.extend(RectangleClickButton.prototype, button); 7 _.extend(RectangleClickButton.prototype, onclickControl);
1 var Zephyros = require('node-zephyros'); 2 3 var z =
new Zephyros(); 4 5 z.bind('m', ['Cmd', 'Ctrl']) 6 .windowFocused() 7 .maximize(); 8 API
Window Management Apps
workflow
Workflows #1 1 require('shelljs/global'); 2 var Zephyros = require('node-zephyros'); 3
4 var z = new Zephyros(); 5 6 z.listen('app_launched') 7 .appTitle() 8 .then(function(app){ 9 if( app.title === 'MacVim' ){ 10 exec('mysql.server start'); 11 } 12 });
Workflows #2 1 var Zephyros = require('node-zephyros'); 2 appdb =
fs.createWriteStream('app.db', { 3 flags: 'a'}); 4 5 var z = new Zephyros(); 6 7 z.listen('focus_changed') 8 .appTitle() 9 .then(function(app){ 10 var now = (new Date()).valueOf(); 11 appdb.write(app.title + ',' + now + '\n'); 12 });
1 var Zephyros = require('node-zephyros'), 2 request = require('request'); 3
4 var z = new Zephyros(); 5 6 var cities = ['London', 'Manchester', 'Bath', 'Leeds', 'Liverpool']; 8 z.bind('c', ['Cmd', 'Alt', 'Ctrl']) 9 .chooseFrom({ 10 list: cities, 11 title: 'Cities', 12 lines_tall: 5, 13 chars_wide: 30 14 }) 15 .then(function(index){ 16 request('http://api.openweathermap.org/data/2.5/weather?q=' + cities[index] + 17 ',uk', function(err, res, body){ 19 body = JSON.parse(body); 20 z.api().alert(body.weather[0].description + ' in ' + cities[index]); 22 }); 23 }); Workflows #3
None
and you?
Thanks @danielepolencic http:/ /danielepolencic.github.io/node-zephyros/