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
# Generate Lets Encrypt Cert For Subdomain | |
sudo certbot -i apache -a manual --preferred-challenges dns -d b.example.org |
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
// 1. UIView Border | |
extension UIView { | |
func addBorder(edges: UIRectEdge, color: UIColor = .black, thickness: CGFloat = 1.0) { | |
func borderView() -> UIView { | |
let view = UIView(frame: .zero) | |
view.translatesAutoresizingMaskIntoConstraints = false | |
view.backgroundColor = color | |
return view | |
} | |
if edges.contains(.top) || edges.contains(.all) { |
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
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | |
// Manually authenticate user in controller | |
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles()); | |
$this->get('security.token_storage')->setToken($token); | |
$this->get('session')->set('_security_main', serialize($token)); |
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
<?php | |
// SQL Logger | |
function sql_logger() { | |
global $wpdb; | |
$log_file = fopen(ABSPATH.'/sql_log.txt', 'a'); | |
fwrite($log_file, "//////////////////////////////////////////\n\n" . date("F j, Y, g:i:s a")."\n"); | |
foreach($wpdb->queries as $q) { | |
fwrite($log_file, $q[0] . " - ($q[1] s)" . "\n\n"); | |
} | |
fclose($log_file); |