Skip to content

Instantly share code, notes, and snippets.

View sidati's full-sized avatar
💭
I may be slow to respond.

Sidati Messaiti sidati

💭
I may be slow to respond.
View GitHub Profile
@sidati
sidati / wp-file-system-helper.php
Last active March 9, 2016 19:42
WP File System Helper
<?php
private static function wp_filesystem_init($form_url, $context, $fields) {
if (!function_exists('request_filesystem_credentials')) {
load_template(ABSPATH.'wp-admin/includes/file.php');
}
if ((!is_admin() && 'direct' !== get_filesystem_method(null, $context)) ||
false === ($creds = request_filesystem_credentials($form_url, null, false, false, $fields))) {
return false;
@sidati
sidati / memorySizeOfObject.js
Created July 8, 2017 00:26
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@sidati
sidati / dev-tools.txt
Last active October 19, 2020 11:22
Filters in Chrome Dev Tools – How to Include, Exclude Resources
# Properties are sorted alphabetically
# Notice the `-` sign which is used as NOT or Exclude filter
domain:
-domain:
# Use a * character to include multiple domains.
# ie.: *.com, domain:google.com, -domain:twitter.com
has-response-header:
-has-response-header:
@sidati
sidati / setup.md
Created March 1, 2021 11:45 — forked from novemberborn/setup.md
OS X Redirect ports 80 and 443 to 8080 and 8443 respectively

Changes with .dev domains in mind.

Create /etc/pf.anchors/dev, containing:

rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443