Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
zhiyelee / snnipt.lua
Last active February 24, 2024 14:36
Hammerspoon: move cursor between screens
--- start move cursor bewteen screens
function move_cursor(direction)
return function()
local screen = hs.mouse.getCurrentScreen()
local nextScreen
if direction == "right" then
nextScreen = screen:next()
else
nextScreen = screen:previous()
end
@zhiyelee
zhiyelee / hammerspoon_app_shortcut.lua
Created June 7, 2020 16:24
Hammerspoon app lunch shortcut
--- start quick open applications
function open_app(name)
return function()
hs.application.launchOrFocus(name)
if name == 'Finder' then
hs.appfinder.appFromName(name):activate()
end
end
end
@zhiyelee
zhiyelee / abbr.md
Last active August 29, 2022 08:57
Some Common Used Abbreviations

common used phrases

  • AFAIK == as far as I know
  • IMO == in my opinion
  • IMHO == in my humble opinion
  • LGTM == look good to me
  • AKA == also know as
  • ASAP == as sone as possible
  • BTW == by the way
  • FAQ == frequently asked questions
@zhiyelee
zhiyelee / start_rescuetime_focustime.lua
Created June 7, 2020 15:35
Hammerspoon: start RescueTime Focus on with shortcuts
--- start resucueTime FocusTime session
function start_focus_time(duration)
return function()
local focusTimeURLTpl = "https://www.rescuetime.com/anapi/start_focustime?key=%s&duration=%d"
local RESCUETIME_KEY = 'YOUR_RESCUETIME_APIKEY'
hs.http.post(string.format(focusTimeURLTpl, RESCUETIME_KEY, duration))
end
end
hs.hotkey.bind({"alt", "shift"}, "f", start_focus_time(30))
@zhiyelee
zhiyelee / snnipt_with_circle.lua
Last active June 29, 2022 22:46
hammerspoon: move cursor between screens and show a circle around the mouse
--- start move cursor bewteen screens
function show_circle()
local mousepoint = hs.mouse.getAbsolutePosition()
local color = {["red"]=0,["blue"]=1,["green"]=0,["alpha"]=0.5}
local circle = hs.drawing.circle(hs.geometry.rect(mousepoint.x - 40, mousepoint.y - 40, 80, 80))
circle:setStrokeColor(color)
circle:setFill(false)
circle:setStrokeWidth(5)
circle:bringToFront(true)
circle:show(0.5)
{
"sections": [
{
"title": "Continue Watching",
"position": 0,
"tiles": [
{
"content_id": "494842",
"title": "Shottas",
"image_ratio": "16by9",
@zhiyelee
zhiyelee / .gitignore
Last active March 2, 2016 20:40
AVA_superTest
node_modules
@zhiyelee
zhiyelee / README.md
Last active December 23, 2015 03:08
yui oop demos

yui oop demo gist

  • merge mix

  • OOP

    • extend
    • augment
    • aggregate
  • bind rbind

@zhiyelee
zhiyelee / .gitignore
Last active December 19, 2015 12:19
node js demo
node_modules
/**
* @description check dot whether in a triangle
* @author zhiyelee
*/
/**
* for tri like below:
* A
* * *
* B * * * C