Skip to content

Instantly share code, notes, and snippets.

show lc_collate;
lc_collate
-------------
en_US.UTF-8
(1 row)
soocial_test=# select lower(''), upper(''), lower('ble, trret'), upper('ble, trret'), lower('LUT K'), upper('lut '), lower('');
lower | upper | lower | upper | lower | upper | lower
-------+-------+------------+------------+-------+-------+-------
| | ble, trret | BLE, TRRET | lut k | LUT |
@tijn
tijn / scss.xml
Created June 29, 2011 09:23 — forked from razor-x/scss.xml
SCSS syntax highlighting for Kate. Based on Kate CSS syntax file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
Kate SCSS syntax highlighting definition
A few lines were added to the Kate CSS syntax highlighting definition to support SCSS
The latest version of this file can be found at https://gist.github.com/958598
Changelog:
@tijn
tijn / equality_in_ruby.rb
Created August 6, 2011 19:31
a self-describing program
# The == comparison operator checks whether two values are equal.
true == true
'==' == '=='
# eql? checks if two values are equal and of the same type.
true.eql? true
require 'benchmark'
def do_it(n = 1_000_000)
Benchmark.bm(15) do |bm|
foo = :foo
bm.report("Symbol == Symbol") { n.times { :foo == foo } }
bm.report("to_sym") { n.times { "foo".intern } }
bm.report("hash") { n.times { "foo".hash } }
bar = "bar"
baz = "baz".freeze
@tijn
tijn / delete_line.rb
Created May 4, 2012 11:33
script to delete one line from a file, uses input like this: ~/.ssh/known_hosts:60
#!/usr/bin/env ruby
# script to delete one line from a file
# because remembering how sed works is too hard
# Tijn Schuurmans - May 4, 2012
def print_usage
puts <<-end_usage_description
delete_line
@tijn
tijn / quassel-gnome3.qss
Last active October 5, 2015 19:08
stylesheet for quassel in gnome 3 (adwaita)
/*
QT Stylesheet to make Quassel fit better with Gnome3
====================================================
I stole these colours from a vim-config:
-----------------------------------------
Adwaita:
- cool-fg #000000
@tijn
tijn / setup_sublime_text_2.rb
Created July 15, 2012 11:43
A simple script to quickly set up Sublime Text 2 to use it in Gnome 3
#!/usr/bin/env ruby
# A simple script to quickly set up Sublime Text 2 to use it in Gnome 3.
#
# It will:
# * copy the official Sublime icons into your ~/.local/share/icons/hicolor/[...]
# * make a symlink to sublime_text in your ~/bin/
# * create a sublime_text_2.desktop in ~/.local/share/applications/
#
# Licence: WTFPL
@tijn
tijn / git-lines-per-author.sh
Last active January 31, 2019 19:18
Produce a histogram with lines of code per author.
#!/bin/sh
git ls-tree -r HEAD | sed -Ee 's/^.{53}//' | \
while read filename; do file "$filename"; done | \
grep -E ': .*text' | sed -E -e 's/: .*//' | \
while read filename; do git blame --line-porcelain "$filename"; done | \
sed -n 's/^author //p' | \
sort | uniq -c | sort -rn
@tijn
tijn / splitter.rb
Last active December 15, 2015 18:09 — forked from ChrisLundquist/splitter.rb
split off subdirectories of a git repo to their own repo.
#!/usr/bin/env ruby
# preliminary:
#
# git clone remote_repo repo
# cd repo
# for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done
def git_repo(subdir)
if File.directory?(subdir + "/.git")
@tijn
tijn / fucking.coffee
Created December 6, 2013 14:46
A script to make a hubot respond to foul language.
module.exports = (robot) ->
robot.hear /\bfucking\s+?(\w+)/i, (msg) ->
msg.send "fucking #{msg.match[1]} indeed".toUpperCase()
robot.hear /\bfuck(\s+?(?:my|your|this|those|these|our))?\s+?(\w+)/i, (msg) ->
pronoun = msg.match[1]
subject = msg.match[2]
pronoun = pronoun.trim().toLowerCase() if pronoun