Skip to content

Instantly share code, notes, and snippets.

Michael Nutt mnutt

Block or report user

Report or block mnutt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mnutt
mnutt / Instrument Anything in Rails 3.md
Created Sep 6, 2010
How to use Rails 3.0's new notification system to inject custom log events
View Instrument Anything in Rails 3.md

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
@mnutt
mnutt / example.md
Last active Sep 5, 2019
TreeStyleTab sidebar tabs only
@mnutt
mnutt / prettier.sh
Created Jun 6, 2019
Prettier project wrapper
View prettier.sh
#!/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
In-memory write-through cache with async/await
View before-async-await.js
// before async/await
cache.oldThrough(cacheKey, function getData(cb) {
fetch(appUrl, function(response) {
response.text(function(data) {
cb(data);
});
});
}, function (template) {
res.end(template);
View some-html-attack-vectors.md

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
View example.sketch.json
{
"_class": "page",
"do_objectID": "E3FF0D84-6B60-4A08-80D9-EDDA368D2198",
"booleanOperation": -1,
"exportOptions": {
"_class": "exportOptions",
"exportFormats": [],
"includedLayerIds": [],
"layerOptions": 0,
"shouldTrim": false
@mnutt
mnutt / gist:9937805
Last active Feb 2, 2018
Determining URL schemes of an iTunes app
View gist:9937805
  1. Get The Unarchiver (compression utility) here: https://theunarchiver.com/
  2. Opens iTunes for Mac and download the app from the app store
  3. Open Finder and navigate to Music/iTunes/iTunes Media/Mobile Applications
  4. Select the application you downloaded, and drag it into The Unarchiver to extract it
  5. Navigate into the extracted directory, then into Payload, and you should see an app
  6. Right-click the app and select "Show Package Contents"
  7. Find the file "Info.plist", right-click it and select "Quick Look"
  8. Look through the file for CFBundleURLSchemes (it'll be indented)
  9. Right below that should be , with each URL scheme inside a tag.
@mnutt
mnutt / prettier.sh
Last active Jan 22, 2018
Only run prettier if a config file is present
View prettier.sh
#!/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`
View mac-framework-includes-take-2.patch
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}
View mac_framework_includes.patch
diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake
index 909efc00dba..59f8f7eab45 100644
--- a/Source/WebKit/PlatformQt.cmake
+++ b/Source/WebKit/PlatformQt.cmake
@@ -410,11 +410,19 @@ generate_header("${FORWARDING_HEADERS_DIR}/QtWebKit/QtWebKitDepends"
#endif
")
+if (MACOS_BUILD_FRAMEWORKS)
+ set(WebKit_INCLUDE_DESTINATION "${LIB_INSTALL_DIR}/QtWebKit.framework/Versions/5/Headers")
You can’t perform that action at this time.