Skip to content

Instantly share code, notes, and snippets.

View stephancasas's full-sized avatar

Stephan Casas stephancasas

View GitHub Profile
@uchcode
uchcode / SoundcloudStatusBar.js
Created December 31, 2016 16:57
JXA (JavaScript for Automation) StatuBar applet example.
ObjC.import('Cocoa')
ObjC.import('WebKit')
App = Application.currentApplication()
App.includeStandardAdditions = true
MyAction = SimpleSubclass('Action', {
quit(sender) {
App.quit()
},
@uchcode
uchcode / JXA-WebView.js
Created December 31, 2016 06:57
JXA (JavaScript for Automation) WebView applet template.
ObjC.import('Cocoa')
ObjC.import('WebKit')
MyWindow = WebViewWindow('http://www.youtube.com/')
MyWindow.makeKeyAndOrderFront(null)
//=====================================================================
function Window(x, y, width, height) {
let r = $.NSMakeRect(x, y, width, height)
@nrollr
nrollr / nginx.conf
Last active June 17, 2025 07:18
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active July 19, 2025 17:20
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@cslarsen
cslarsen / objc-gcc.m
Created March 20, 2012 19:23
How to compile Objective-C on the command line on Mac OS X
/*
* To compile objective-c on the command line:
*
* gcc -framework Foundation objc-gcc.m
*
* You may have to link with -lobjc or other libs,
* as required.
*/
#import <Foundation/Foundation.h>
/*
* ctrl-f1
* -------
* Query or toggle the "Full Keyboard Access" hotkey, Ctrl-F1
*
* make CC=clang CFLAGS="-framework Carbon" ctrl-f1
*/
#include <Carbon/Carbon.h>