Skip to content

Instantly share code, notes, and snippets.

View mnutt's full-sized avatar

Michael Nutt mnutt

View GitHub Profile
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 0202f17b21..c095859ca6 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -302,8 +302,9 @@
"hb_buffer_destroy(buffer);"
]
},
- "headers": "harfbuzz/hb.h",
+ "headers": "hb.h",
function relativeHash(newUrl);
const currentUrl = new URL("http://somesite.com/index.html#/page/a"); // or just document.location
const newPath = new URL("../blog/b", `http://example.com${currentUrl.hash.slice(1)}`).pathname;
currentUrl.hash = `#${newPath}`;
}
@mnutt
mnutt / created-times.rb
Last active April 17, 2020 00:37
Generate CSV of file created/modified times
# USAGE:
# 1. Save this file to your Desktop (Cmd-S, click Desktop in the left sidebar)
# 2. Open Terminal.app (Cmd-space, type "terminal", hit enter)
# 3. Type this, exactly: ruby ~/Desktop/created-times.rb
# 4. You should see some output about checking directories and how many files were loaded.
# 5. A media-.......csv file will appear on your Desktop, which can be loaded with Excel
require 'time'
extensions = ["jpg", "jpeg", "mov", "heic", "mp4"]
@mnutt
mnutt / prettier.sh
Created June 6, 2019 18:51
Prettier project wrapper
#!/bin/bash
# This wrapper prefers your project's prettier version, and only runs prettier if your project has configured it.
# Save this file as `prettier` in your $PATH, or set your editor's prettier plugin to use it as the prettier binary
# find the file prettier is trying to prettify
file=${BASH_ARGV[0]:="."}
# optionally set where the real prettier command can be found
@mnutt
mnutt / before-async-await.js
Last active May 15, 2019 19:52
In-memory write-through cache with async/await
// before async/await
cache.oldThrough(cacheKey, function getData(cb) {
fetch(appUrl, function(response) {
response.text(function(data) {
cb(data);
});
});
}, function (template) {
res.end(template);

Some HTML attack vectors (not all)

POST/PUT/DELETE/PATCH actions

  • via XHR
    • sends user's cookies
    • cross-origin restrictions protect against malicious sites, unless you have bad CORS settings
  • via form
    • sends user's cookies
    • need to protect with csrf token
  • or you can prevent form POST entirely with x-requested-with request header check
{
"_class": "page",
"do_objectID": "E3FF0D84-6B60-4A08-80D9-EDDA368D2198",
"booleanOperation": -1,
"exportOptions": {
"_class": "exportOptions",
"exportFormats": [],
"includedLayerIds": [],
"layerOptions": 0,
"shouldTrim": false
@mnutt
mnutt / example.md
Last active August 9, 2024 02:54
TreeStyleTab sidebar tabs only

Example:

firefox

@mnutt
mnutt / prettier.sh
Last active January 22, 2018 19:23
Only run prettier if a config file is present
#!/bin/bash
# find the file prettier is trying to prettify
file=${BASH_ARGV[0]:="."}
# optionally set where the real prettier command can be found
prettier=`which prettier`
# try to see if there is a project-specific `prettier` to use
node_modules=`npm root`
diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake
index 4c54c1c5de1..858e2e47d8d 100644
--- a/Source/cmake/WebKitMacros.cmake
+++ b/Source/cmake/WebKitMacros.cmake
@@ -265,6 +265,8 @@ macro(WEBKIT_FRAMEWORK _target)
${${_target}_HEADERS}
${${_target}_SOURCES}
${${_target}_DERIVED_SOURCES}
+ ${${_target}_PRIVATE_HEADERS}
+ ${${_target}_PUBLIC_HEADERS}