#!/bin/sh | |
# usage: | |
# ql /tmp/file.jpg | |
# cat /tmp/file.jpg | ql | |
# cal -h | ql | |
if [ -z "$*" ]; then | |
cat > /tmp/ql.stdin | |
mime_type=$(file --brief --mime-type /tmp/ql.stdin) |
import * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
# frozen_string_literal: true | |
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'twentysix' |
{"version":1,"resource":"file:///Users/Swizec/Documents/websites/swizec.com/src/pages/blog/week-17-what-happens-when-you-only-eat-meat-for-a-year/index.mdx","entries":[{"id":"Q6eg.mdx","timestamp":1652114366832}]} |
<VirtualHost ...> | |
... | |
# Reverse Proxy | |
ProxyRequests Off | |
#ProxyPreserveHost On | |
RequestHeader set X-Forwarded-Proto "https" | |
ProxyPass /blog http://blog.example.org/blog | |
ProxyPassReverse /blog http://blog.example.org/blog | |
... | |
</VirtualHost> |
Fix iOS Project Swift Errors
In order to build the iOS app in the latest XCode, you need to convert the project to Swift 3.0. After you do this, when you try to run or archive the project, you will get a bunch of errors. This section explains how to fix them.
IMPORTANT NOTE: Fix all the RED errors. There will also be yellow triangles and the option to "update to recommended settings". Do NOT fix these things and do NOT update to recommended settings.
Info from Apple on what has changed in Swift: http://adcdownload.apple.com/Developer_Tools/Xcode_8_beta_6/Release_Notes_for_Xcode_8_beta_6.pdf ("New in Xcode 8 beta 6 - Swift Compiler" section on page 8)
"NSURL" is not implicitly convertible to "URL"
/** | |
* MAKE ELECTRON APP FEEL MORE NATIVE | |
* | |
* * Prevent dragging all HTML elements, specially: | |
* - images | |
* - links (anchors) | |
* | |
* * Prevent text selection | |
*/ |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!