Skip to content

Instantly share code, notes, and snippets.

@SaladFork
SaladFork / bootstrap4_breadcrumbs_builder.rb
Last active July 25, 2019 22:23
`breadcrumbs_on_rails` builder with Bootstrap 4 compatible output
# `Bootstrap4BreadcrumbsBuilder `is a Bootstrap 4 (alpha6) compatible breadcrumb
# builder. It is designed to work with the `breadcrumbs_on_rails` gem as a
# drop-in builder replacement.
#
# Bootstrap4BreadcrumbsBuilder accepts a limited set of options:
#
# | option | default | description |
# | ---------------- | ------- | ------------------------------------------ |
# | `:container_tag` | `:ol` | What tag to use for the list container |
# | `:tag` | `:li` | What HTML tag to use for breadcrumb items |
anonymous
anonymous / rotate_lines.vim
Created March 3, 2016 15:05
Vim rotating lines "screensaver"
" Press \r to start rotating lines and <C-c> (Control+c) to stop.
function! s:RotateString(string)
let split_string = split(a:string, '\zs')
return join(split_string[-1:] + split_string[:-2], '')
endfunction
function! s:RotateLine(line, leading_whitespace, trailing_whitespace)
return substitute(
\ a:line,
@valbertovc
valbertovc / pagination.html
Last active August 26, 2021 16:48
Django Semantic-ui paginator templatetag with arrows
{% load i18n paginator %}
<div class="ui right floated pagination small menu">
{% first_link cl %}
{% previous_link cl %}
{% if pagination_required %}
{% for i in page_range %}
{% paginator_number cl i %}
{% endfor %}
#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
@bpierre
bpierre / README.md
Last active February 15, 2024 18:40
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.

My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0

@sciurius
sciurius / btsync-keygen
Created May 2, 2014 13:40
Perl script to generate secrets and config data for BTsync
#!/usr/bin/perl -w
# Key generation for BTsync.
# Author : Johan Vromans
# Created On : Sun Apr 27 20:31:57 2014
# Last Modified By: Johan Vromans
# Last Modified On: Fri May 2 15:37:24 2014
# Update Count : 47
# Status : Unknown, Use with caution!
@codecaffeine
codecaffeine / randimg.rb
Last active February 21, 2024 22:22
Random Image Generator (imagemagick + ruby)
#!/usr/bin/env ruby
# Script to generate random images. Based on http://www.imagemagick.org/Usage/canvas/#random_blur
require 'optparse'
options = {}
optparse = OptionParser.new do |opts|
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <cburgmer@ira.uka.de>'
__url__ = 'http://github.com/cburgmer/upsidedown'
# this scrubs emoji sequences from a string - i think it covers all of them
def strip_emoji ( str )
str = str.force_encoding('utf-8').encode
clean_text = ""
# emoticons 1F601 - 1F64F
regex = /[\u{1f600}-\u{1f64f}]/
clean_text = str.gsub regex, ''
@granoeste
granoeste / webkitmediasource-is-type-supported.html
Last active December 26, 2021 10:54
[JavaScript][HTML5][MediaSource] MediaSource.isTypeSupported
<!DOCTYPE html>
<html>
<head>
<script>
window.MediaSource = window.MediaSource || window.WebKitMediaSource;
function testTypes(types) {
for (var i = 0; i < types.length; ++i)
console.log("MediaSource.isTypeSupported(" + types[i] + ") : " + MediaSource.isTypeSupported(types[i]));
}