Skip to content

Instantly share code, notes, and snippets.

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes] no
Use of uninitialized value $what in concatenation (.) or string at /System/Library/Perl/5.18/App/Cpan.pm line 553, <STDIN> line 1.
Warning: You do not have write permission for Perl library directories.
To install modules, you need to configure a local Perl library directory or
function switchBrowser()
local current = hs.application.frontmostApplication()
local bool,URL
if (current:name() == "Google Chrome") then
bool,URL = hs.osascript.applescript('tell application "Google Chrome" to get URL of active tab of window 0')
if bool then
if (string.match(URL,'chrome://')) then
hs.alert('not a valid link')
else
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)

init.lua

function cycleInputMethod()
  if hs.keycodes.currentSourceID() == "com.apple.keylayout.US" then
    hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC" )
  elseif hs.keycodes.currentSourceID() == "com.apple.inputmethod.SCIM.ITABC" then
    hs.keycodes.currentSourceID("com.apple.inputmethod.Kotoeri.Japanese")
  elseif hs.keycodes.currentSourceID() == "com.apple.inputmethod.Kotoeri.Japanese" then
    hs.keycodes.currentSourceID("com.apple.keylayout.US")
  end

不是不可以提前声明,而是不需要,你看是不是?

以下代码并不会报错

function main()
  aaa()
end

function aaa()