Skip to content

Instantly share code, notes, and snippets.

@codeanpeace
codeanpeace / app.js
Created December 7, 2022 22:29 — forked from cblavier/app.js
Responsive Phoenix LiveView
const Hooks = { ViewportResizeHooks}
const connectLiveSocket = () => {
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content')
const liveSocket = new LiveSocket('/my_app/live', Socket, {
params: {
_csrf_token: csrfToken,
viewport: {
width: window.innerWidth,
height: window.innerHeight
@codeanpeace
codeanpeace / soundcloudEmbedVolumeFix.js
Last active October 6, 2020 22:29 — forked from propagated/soundcloudEmbedVolumeFix.js
turn down the dang volume of embedded soundcloud iframes
//load soundcloud js api if needed
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://w.soundcloud.com/player/api.js';
document.head.appendChild(script);
//get the id of the player iframe or inject it using chrome
// var id = 'scplayer',
// widgetIframe = document.getElementById(id),
@codeanpeace
codeanpeace / toggle_audio_output.scpt
Created January 2, 2019 00:09
AppleScript that switches audio, toggling between display and AMP / DAC
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Sound"
delay 1
click radio button "Output"
@codeanpeace
codeanpeace / toggle_display_rotation.scpt
Created January 2, 2019 00:06
AppleScript that rotates display, toggling between landscape and portrait mode
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell application process "System Preferences"
tell window "DELL U2414H"
delay 1
click pop up button 2 of tab group 1

Keybase proof

I hereby claim:

  • I am codeanpeace on github.
  • I am harrisontan (https://keybase.io/harrisontan) on keybase.
  • I have a public key whose fingerprint is 58DB AB70 53A8 2CFC A29C 18E7 075F 898E CC0F 8A4B

To claim this, I am signing this object:

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.
@codeanpeace
codeanpeace / README.md
Last active December 30, 2015 12:59 — forked from JoelBesada/README.md

This is a command for Magicscroll Web Reader bookmarklet.