Skip to content

Instantly share code, notes, and snippets.

View unrealapex's full-sized avatar
🏳️‍⚧️
trans rights are human rights!

Grace unrealapex

🏳️‍⚧️
trans rights are human rights!
View GitHub Profile
// taken from here: https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
function onMouseUp(e) {
const activeTextarea = document.activeElement;
const selection = activeTextarea.value.substring(
activeTextarea.selectionStart, activeTextarea.selectionEnd
);
}
var randomHexColor = () => "#" + Math.floor(Math.random()*16777215).toString(16);
var hours = 12;
var suffix = hours <= 12 ? "PM" : "AM";
hours = ((hours + 11) % 12 + 1) + suffix;
console.log(hours);
<head>
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- jQuery ui -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
</head>
// document ready shorthand: https://www.w3schools.com/jquery/jquery_syntax.asp
$(function(){
// jQuery methods go here...
});
/* taken from: https://stackoverflow.com/a/13515693/14111707 */
.center {
display: flex;
justify-content: center;
align-content: center;
flex-direction: column;
/* Column | row */
text-align: center;
}
map tr_walkway_rc2
sv_cheats 1
sv_allow_point_servercommand always
retry
jointeam red
" auto save file when it is modified
augroup auto_save
autocmd!
" call save function
autocmd BufModifiedSet * call AutoSave()
augroup end
" save function that is called when buffer is modified
function AutoSave()
if (bufname() != "" && &buftype == "" && &filetype != "")
gamemoderun %command% -noforcemaccel -noforcemspd -novid -nojoy -fullscreen -nosteamcontroller -nohltv -particles 1 -precachefontchars -noquicktime
" taken from https://vi.stackexchange.com/a/2187/35229
nnoremap <C-e> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>