Skip to content

Instantly share code, notes, and snippets.

View markodvornik's full-sized avatar

Marko Dvornik markodvornik

View GitHub Profile
@chockenberry
chockenberry / ql.sh
Last active March 4, 2024 23:40
QuickLook for macOS shell
#!/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
@miharekar
miharekar / Gemfile
Last active January 28, 2019 14:49
UPN QR to N26 and Toshl
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'sinatra'
gem 'twentysix'
@justsml
justsml / fetch-api-examples.md
Last active April 22, 2025 13:44
JavaScript Fetch API Examples
@Swizec
Swizec / History|-1096ae74|entries.json
Last active May 11, 2022 13:45
Visual Studio Code Settings Sync Gist
{"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}]}
@4ley
4ley / apache.conf
Created March 28, 2017 12:10
WordPress / Apache / Reverse Proxy
<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>
@aldeed
aldeed / fix_ios_errors.md
Last active February 13, 2020 10:06
Fix iOS Project Swift Errors

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"

@msuchodolski
msuchodolski / electron_drag_disable.css
Last active December 8, 2024 12:05
Disable dragging and selecting html elements (like links, images etc...) in Electron
/**
* MAKE ELECTRON APP FEEL MORE NATIVE
*
* * Prevent dragging all HTML elements, specially:
* - images
* - links (anchors)
*
* * Prevent text selection
*/
@agnoster
agnoster / README.md
Last active March 10, 2025 15:41
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!