Skip to content

Instantly share code, notes, and snippets.

@stefansundin
stefansundin / git-bundle-hook.md
Last active September 6, 2024 00:10 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@stefansundin
stefansundin / make-chrome-app.sh
Last active March 9, 2025 19:16
Create Chrome apps in Mac OS.
#!/bin/sh
# wget https://gist.githubusercontent.com/stefansundin/c89fd15bae5a58831790/raw/make-chrome-app.sh
# chmod +x make-chrome-app.sh
# ./make-chrome-app.sh
echo "Note that the app will run with a separate data dir and thus not have your regular extensions and settings."
echo
echo "What should the app be called?"
read name
echo
@stefansundin
stefansundin / install-pre-commit.sh
Last active June 16, 2025 05:44
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@stefansundin
stefansundin / 1.SubRip_batch.md
Last active January 3, 2016 05:19
A patch I made for SubRip 1.50b4 that enables batch processing.

Patch for SubRip batch processing

Based on SubRip 1.50 Beta 4.

Improvements:

  • Batch support.
  • Always save in Unicode.
  • Remember previously used character matrix file (auto-load).
  • Checkbox for auto-running post-OCR correction.
  • Auto-select correct language in post-OCR dialog.
  • Remember the last used save directory.
@stefansundin
stefansundin / 1.namedays-preview.png
Last active January 3, 2021 08:47
Google Calendar week numbers and Swedish namedays. https://sites.google.com/site/gcalweeknumbers/
1.namedays-preview.png
@stefansundin
stefansundin / 1.gvidcomments.png
Last active January 3, 2016 02:29
Blast from the past. This old Greasemonkey script displayed information about the comments your videos had in your Google Video Status pages, when Google Video was still alive and kicking. R.I.P. Google Video, the only reason people used it was because it didn't have a limit on the video length.
1.gvidcomments.png
@stefansundin
stefansundin / ltu_username.user.js
Last active January 1, 2016 23:09
Old Greasemonkey/Tampermonkey script, but could be nice to have for people studying at Luleå University of Technology (LTU).
// ==UserScript==
// @name LTU Username
// @namespace https://gist.github.com/stefansundin/
// @homepage https://gist.github.com/stefansundin/8214929
// @downloadURL https://gist.github.com/stefansundin/8214929/raw/ltu_username.user.js
// @version 1.0
// @author Stefan Sundin
// @description Autofill username
// @include https://logon.pub.ltu.se/cgi-bin/logon.cgi
// @include https://fronter.com/ltu/
@stefansundin
stefansundin / flattr-gadget.xml
Last active January 1, 2016 20:09
Google Gadget for Flattr.
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Flattr button" author="Stefan Sundin" width="55" height="62" scrolling="false"></ModulePrefs>
<UserPref name="url" datatype="string" default_value="" />
<UserPref name="uid" datatype="string" default_value="" />
<UserPref name="title" datatype="string" default_value="" />
<UserPref name="desc" datatype="string" default_value="" />
<UserPref name="cat" datatype="string" default_value="software" />
<UserPref name="lang" datatype="string" default_value="en_GB" />
<UserPref name="tags" datatype="string" default_value="" />
@stefansundin
stefansundin / youtube-iframe.xml
Last active January 1, 2016 19:59
Google Gadget to embed YouTube videos.
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="YouTube iframe embed" author="Stefan Sundin" width="640" height="390"></ModulePrefs>
<UserPref name="id" datatype="string" default_value="" />
<UserPref name="width" datatype="string" default_value="" />
<UserPref name="height" datatype="string" default_value="" />
<UserPref name="args" datatype="string" default_value="" />
<Content type="html">
<![CDATA[
<script type="text/javascript">
@stefansundin
stefansundin / 1-devtld.js.md
Last active October 29, 2021 23:57
A node.js server to redirect custom TLDs in Chrome without the need for the http:// prefix. You can extend this to do all kinds of things.

What this is

A simple node.js server to redirect whatever.dev to http://whatever.dev. It also redirects you to other websites based on your query (see tips below).

Tips

You can quickly go to different websites with certain queries:

  • mdn css transition will search MDN for css transition
  • AWS identifiers will take you to the correct place in the AWS console: