This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function reloadInSeconds () { | |
const s = parseInt(prompt('Reload in nearest Nth second, where N is:'), 10); | |
if (isNaN(s)) return; | |
const ms = s * 1e3; | |
const now = Date.now(); | |
const reloadAtTs = (Math.ceil(now / ms) + 1) * ms; | |
console.info('Reloading at', new Date(reloadAtTs).toLocaleString()); | |
const countdownTick = () => { | |
const timeleft = reloadAtTs - Date.now(); | |
const reloadInRounded = Math.round(timeleft/1e3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mix = (hex1, hex2, percent) => { | |
const breakup = (hex) => hex.match(/[a-f0-d]{2}/ig).map(n => parseInt(n, 16)); | |
const rgb1 = breakup(hex1); | |
const rgb2 = breakup(hex2); | |
const mixed = rgb1.map((c, i) => Math.round((c * (1 - percent)) + (rgb2[i] * percent)).toString(16)); | |
return '#'+mixed.map(s => s.length < 2 ? '0'+s : s).join(''); | |
}; | |
console.log(mix('#000000','#ffffff', .2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@startuml | |
' uncomment the line below if you're using computer with a retina display | |
' skinparam dpi 300 | |
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >> | |
' we use bold for primary key | |
' green color for unique | |
' and underscore for not_null | |
!define primary_key(x) <b>x</b> | |
!define unique(x) <color:green>x</color> | |
!define not_null(x) <u>x</u> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@-moz-document url-prefix("https://derpibooru.org"), url-prefix("https://trixiebooru.org") { | |
.interaction--fave .fa, | |
.interaction--upvote .fa, | |
.interaction--downvote .fa, | |
.interaction--comments .fa { | |
color: transparent; | |
background-image: url("https://derpicdn.net/img/view/2017/4/1/1401039.svg"); | |
display: inline-block; | |
background-size: 64px 64px; | |
width: 32px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseCommentDate(el){ | |
var _months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Nov','Dec'], | |
_pad = function(n){return n<10?'0'+n:n}, | |
time = el.title.replace(/^.*\(at (\d{1,2}):(\d{1,2}):(\d{1,2}) ([AP]M)\)$/, function(_,h,m,s,ampm){ | |
if (ampm === 'PM'){ | |
h = parseInt(h,10)+12; | |
if (h >= 24) | |
h -= 24; | |
} | |
else if (ampm === 'AM' && h == 12) h = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# <Config> | |
backuppath="/path/to/backups" | |
pmapath="/path/to/phpMyAdmin" | |
# </Config> | |
# Colors | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[1;33m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(pageStepDelay,screwComments){ | |
var halfStepDelay = pageStepDelay / 2; | |
if (!/\.deviantart\.com$/.test(window.location.host) || !/^\/notifications\/?$/.test(window.location.pathname)) | |
return false; | |
function notify(message,visibleForMS,callback){ | |
console.log(message); | |
if (visibleForMS !== false) visibleForMS = typeof visibleForMS === 'number' ? visibleForMS : 3000; |