Skip to content

Instantly share code, notes, and snippets.

View vancura's full-sized avatar
🤓
Kuju pixle!

Václav Vančura vancura

🤓
Kuju pixle!
View GitHub Profile
@vancura
vancura / git-diff-summarizer.py
Last active November 19, 2023 11:48
This script summarizes staged Git changes, utilizes GPT-4 to generate a Git commit message, and then copies the results to the clipboard.
import subprocess
import clipboard
from openai import OpenAI
client = OpenAI(api_key = "your-openai-key")
# This command returns the staged changes as a patch
git_diff_command = ['git', 'diff', '--cached']
result = subprocess.run(git_diff_command, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.DEVNULL)
<?xml version="1.0"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>

Source Code Typography

Presentation: http://www.slideshare.net/vancura/source-code-typography

Quotes

Dumb quotes (also known as straight quotes) are straight and vertical. Proper typography never uses straight quotes. They are left over from the age of typewriters, and their only modern use is for coding.

@vancura
vancura / dribbble-2x-replacer.js
Created August 14, 2015 14:37
Dribbble @2x replacer: change @1x to @2x.
// ==UserScript==
// @name Dribbble 2x
// @namespace http://vancura.org
// @description Use 2x images
// @homepage http://vancura.org
// @version 0.0.1
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @include *://dribbble.com/*
// ==/UserScript==
@vancura
vancura / server.sh
Created May 3, 2015 02:59
Start an HTTP server from a directory, optionally specifying the port
# =========================================================================
# = Start an HTTP server from a directory, optionally specifying the port =
# =========================================================================
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"

Keybase proof

I hereby claim:

  • I am vancura on github.
  • I am vancura (https://keybase.io/vancura) on keybase.
  • I have a public key whose fingerprint is 9EFF C6EE 57AB 1625 AAA5 2145 BC60 963F E661 20D0

To claim this, I am signing this object:

@vancura
vancura / background-clip:-text-detection.markdown
Created October 8, 2013 09:21
A Pen by Václav Vančura.
@vancura
vancura / variscroll-howto.md
Created September 5, 2012 18:18
VariScroll HOW-TO

Just for your information: our new VariScroll engine runs in two modes: automatic or manual:

  • automatic mode: you choose an element to apply VariScroll to, and this element becomes variscrolled. VariScroll itself wraps the element into another div. So if you have something like this: div.myscroll, it becomes: div.variscroll-container > div.myscroll. The old div.myscroll is wrapped into newly created div.variscroll-container. This is needed so the engine works. FYI everything can be undone using the destroy() method.
  • manual mode: you need to create the wrapping divs prior to calling VariScroll, and you send these elements selectors to the engine. This had to be done so the SAY ads could be loaded (they're nasty). Let me show on the Phoenix demo I am working on:
<div id="variscroll">
    <div id="variscroll-roller">
        <div class="unit first">Advertisement</div>
@vancura
vancura / revert-ipa-pngs.sh
Created March 18, 2012 18:32
Revert IPA PNGs
for f in "$@"
do
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -e _fixed.png -revert-iphone-optimizations "$f"
done
@vancura
vancura / less-watcher.rb
Created November 1, 2011 09:41
Folder watcher (replace "less-compile.sh" with your own command)
#!/usr/bin/env ruby
# watch.rb by Brett Terpstra, 2011 <http://brettterpstra.com>
# with credit to Carlo Zottmann <https://github.com/carlo/haml-sass-file-watcher>
# original by Brett Terpstra <http://brettterpstra.com/watch-for-file-changes-and-refresh-your-browser-automatically/>
# fork by Vaclav Vancura / SAY Media <http://saymedia.com>
trap("SIGINT") { exit }
filetypes = ['less']
watch_folder = 'content/media/less'