Skip to content

Instantly share code, notes, and snippets.

View StoneyEagle's full-sized avatar
🦅

Stoney Eagle StoneyEagle

🦅
View GitHub Profile
@clarkio
clarkio / obs-websocket.js
Last active March 6, 2024 22:59
Connecting to OBS Websocket Server with Authentication
const obsConfig = {
address: '127.0.0.1',
port: 4455,
password: 'your-password'
}
const socket = new WebSocket(`ws://${obsConfig.address}:${obsConfig.port}`);
const password = obsConfig.password;
socket.onopen = function(event) {
@PureLandFlying
PureLandFlying / ScrollManager.tsx
Last active January 18, 2023 16:41 — forked from jeffijoe/ScrollManager.jsx
Save and restore scroll position in React
/*
The MIT License
Copyright (c) Jeff Hansen 2018 to present.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W
@markcode
markcode / reprint.js
Last active March 3, 2024 15:01
node.js print resfeshing over the same line
var util = require('util');
var x = 0;
setInterval(function() {
process.stdout.write('hello: ' + x + '\r'); // needs return '/r'
// util.print('hello: ' + x + '\r'); // could use this too
x++;
}, 1000);
@armno
armno / .htaccess
Created February 15, 2013 09:35
Allowing Access-Control-Allow-Origin to multiple domains for Ajax requests
# source: http://www.lowest-common-denominator.com/2010/01/http_access_control_to_multipl.php
# - replace `domain1.com` and `domain2.com`
# - add more domains by separating each domain with a pipe `|`
# - escape dot `.` with a backslash
<IfModule mod_headers.c>
SetEnvIf Origin "^http(s)?://(.+\.)?(domain1\.com|domain2\.com)$" origin_is=$0
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
</IfModule>