This file contains hidden or 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
// Based on: https://gist.github.com/straach/30789d4c30fb5174ec52ea7521cc4e4a | |
// Note: taxpayers without children | |
// Usage example: =net_salary(18000) | |
function calculate_tax_by_slice(total, fromCurrency, toCurrency, percentage) { | |
if (total < fromCurrency) { | |
return 0; | |
} |
This file contains hidden or 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
<?php | |
function get_user_classes() { | |
$dc = get_declared_classes(); | |
return array_filter($dc, function($className) { | |
return (!(new ReflectionClass($className))->isInternal()); | |
}); | |
} |
This file contains hidden or 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
String.prototype.cleanSpaces = function(str) { | |
if (!str) { | |
str = this; | |
} | |
return str.replace(/\s+/g, ' ').trim(); | |
}; |
This file contains hidden or 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 | |
set -uo pipefail | |
IFS=$'\n\t' | |
# 0 12 * * 1 /etc/dehydrated/cron.dehydrated.sh | |
# From: https://serverfault.com/a/512780 | |
# From: https://stackoverflow.com/a/41943779 | |
if tty -s; then | |
exec 5>&1 |
This file contains hidden or 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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Backup MySQL MyISAM with minimum downtime | |
# IMPORTANT! No for InnoDB | |
# Based on https://stackoverflow.com/a/39327926 | |
# TODO: check available space |
This file contains hidden or 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
<?php | |
function check_facebook() { | |
$IP = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false; | |
$UA = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false; | |
if (!$IP || !$UA) return false; | |
$UAs = ['facebookexternalhit', 'Facebot', 'visionutils']; | |
$UAs = array_map('preg_quote', $UAs); | |
if (!preg_match('#^' . implode('|', $UAs) .'#i', $UA)) return false; |
This file contains hidden or 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
javascript:(function(){ | |
var links = []; | |
var likes = _sharedData.entry_data.PostPage[0].media.likes.nodes; | |
var container = document.querySelector('.-cx-PRIVATE-PostInfo__likesInfo'); | |
for (var i in likes) { | |
links.push('<a href="/' + likes[i].user.username + '/" class="-cx-PRIVATE-UserLink__root">' + likes[i].user.username + '</a>'); | |
} | |
container.innerHTML = links.join(', '); | |
})(); |
This file contains hidden or 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/sh | |
FKEY="$HOME/.ssh/id_rsa" | |
FPUB="$FKEY.pub" | |
if [ ! -f "$FPUB" ]; then | |
echo 'Type your email, followed by [ENTER]:' | |
read COMMENT | |
ssh-keygen -t rsa -N '' -C "$COMMENT" -f "$FKEY" |
This file contains hidden or 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^wp-includes/js/tinymce/ - [S=1] | |
RewriteRule ^wp-includes/.*\.(php|rb|py|pl)$ - [F,L,NC] | |
</IfModule> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test</title> | |
<link href="http://fnt.webink.com/wfs/webink.css/?project=C70D1354-AD5F-440B-9B83-AE04D8C2E103&fonts=1B6C2E6C-BB21-53D3-2175-C814D91AD16C:f=Aller-Bold,32A3E230-3101-A662-F6D5-D8B9D0A38A5B:f=Aller-Regular,C7662775-65E4-3DE5-DE19-D61377E1BE79:f=Aller-Light,880096C9-42EC-CFB6-C094-7540101C8F7B:f=Aller-BoldItalic,9C5DF801-C745-E177-908F-369BCECD52B7:f=Aller-Italic,521D5111-7D3C-B8EC-88B6-BBED2BE5F224:f=Aller-LightItalic" rel="stylesheet" type="text/css"/> | |
<style type="text/css"> | |
* { | |
margin: 0; | |
padding: 0; |
NewerOlder