Skip to content

Instantly share code, notes, and snippets.

{
"sections": [
{
"title": "Continue Watching",
"position": 0,
"tiles": [
{
"content_id": "494842",
"title": "Shottas",
"image_ratio": "16by9",
@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 / 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)
@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 / .gitignore
Last active March 2, 2016 20:40
AVA_superTest
node_modules
@zhiyelee
zhiyelee / .gitignore
Last active December 10, 2015 17:20
mocha_sinon_chai TEST DEMO
node_modules
@zhiyelee
zhiyelee / Makefile
Last active August 29, 2015 14:23 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@zhiyelee
zhiyelee / npm_folder_structures.md
Last active August 29, 2015 14:10
Cycles, Conflicts, and Folder Parsimony - NPM Folder Structures

Cycles are handled using the property of node's module system that it walks up the directories looking for node_modules folders. So, at every stage, if a package is already installed in an ancestor node_modules folder, then it is not installed at the current location.

Consider the case above, where foo -> bar -> baz. Imagine if, in addition to that, baz depended on bar, so you'd have: foo -> bar -> baz -> bar -> baz .... However, since the folder structure is: foo/node_modules/bar/node_modules/baz, there's no need to put another copy of bar into .../baz/node_modules, since when it calls require("bar"), it will get the copy that is installed in foo/node_modules/bar.

This shortcut is only used if the exact same version would be installed in multiple nested node_modules folders. It is still possible to have a/node_modules/b/node_modules/a if the two "a" packages are different versions. However, without repeating the exact same package multiple times, an infinite regress will always be pr

@zhiyelee
zhiyelee / st.md
Last active August 29, 2015 14:08
Why do Unix man pages use double backticks in place of double quotes?

Original link in stackoverflow: http://unix.stackexchange.com/q/73989/87921

I've noticed that man pages and other documents formatted by Unix utilities often use double backticks `` followed by double single quotes '' to wrap quoted phrases instead of the double quote character ". Single quotes are similarly replaced. Why is this?

Here are a couple examples, from the man page for grep:

 To find all occurrences of the pattern `.Pp' at the beginning of a line:

       $ grep '^\.Pp' myfile