Skip to content

Instantly share code, notes, and snippets.

View grauwoelfchen's full-sized avatar
🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ

Yasha grauwoelfchen

🐺
Typing with carved wooden keyboard ᕕ( ᐛ )ᕗ
View GitHub Profile
@grauwoelfchen
grauwoelfchen / url.rb
Last active December 15, 2015 14:09
Encode / Decode URL UTF-8 String
#!/usr/bin/env ruby
# encoding: utf-8
require 'optparse'
require 'cgi'
VERSION = '0.2'
def help
<<-MAN
@grauwoelfchen
grauwoelfchen / campfire.css
Last active December 15, 2015 04:59
stylesheet for campfire
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://xxx.campfirenow.com')
{
tr.timestamp_message + tr.timestamp_message,
tr.timestamp_message + tr.enter_message,
tr.timestamp_message + tr.kick_message,
tr.timestamp_message + tr.leave_message,
tr.enter_message + tr.timestamp_message,
tr.kick_message + tr.timestamp_message,
tr.leave_message + tr.timestamp_message,
DB_NAME=# select * from ts_debug('default_french', 'Je veux manger du fromage délicieux');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-------------------+-----------+-----------------------------+---------------+-----------
asciiword | Word, all ASCII | Je | {french_ispell,french_stem} | french_ispell | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | veux | {french_ispell,french_stem} | french_ispell | {veux}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | manger | {french_ispell,french_stem} | french_ispell | {manger}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | du | {french_ispell,french_stem} | french_ispell | {}
DB_NAME=# select * from ts_debug('default_german', 'En Güte zu Hause! Guten Appetit in die Schule');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-------------------+---------+-----------------------------+---------------+------------------
asciiword | Word, all ASCII | En | {german_ispell,german_stem} | german_stem | {en}
blank | Space symbols | | {} | |
word | Word, all letters | Güte | {german_ispell,german_stem} | german_stem | {gut}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | zu | {german_ispell,german_stem} | german_ispell | {}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | Hause | {german_ispell,german_stem} | german_ispell | {hausen,hau,sen}
DB_NAME=# select * from ts_debug('default_german', 'En Güte auf den Berg!');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-------------------+-------+-----------------------------+-------------+---------
asciiword | Word, all ASCII | En | {simple} | simple | {en}
blank | Space symbols | | {simple} | simple | {" "}
word | Word, all letters | Güte | {german_ispell,german_stem} | german_stem | {gut}
blank | Space symbols | | {simple} | simple | {" "}
asciiword | Word, all ASCII | auf | {simple} | simple | {auf}
blank | Space symbols | | {simple} | simple | {" "}
asciiword | Word, all ASCII | den | {simple} | simple | {den}
# load extension
CREATE EXTENSION tsearch2;
# add permission
GRANT ALL ON pg_ts_config to USER_NAME;
GRANT ALL ON pg_ts_config_map to USER_NAME;
GRANT ALL ON pg_ts_dict to USER_NAME;
GRANT ALL ON pg_ts_parser to USER_NAME;
# create configuration
def power(x, n)
case
when n.zero?; 1
when n.even?; power((x * x), n / 2)
else x * power(x, (n - 1))
end
end
def shift_multi(x, y)
m = 0
while x > 1
if x.even?
y = (y << 1) # * 2
x = (x >> 1) # / 2
else
m += y
x -= 1
end
@grauwoelfchen
grauwoelfchen / cli.rb
Last active December 14, 2015 04:29
fibonacci
module Ex8
class Cli
def initialize(options={})
@options = options
end
def run
length = @options[:length].to_i
@output = []
if &filetype == "ruby"
"" syntax check
compiler ruby
setlocal makeprg=ruby\ -c\ %
augroup syntax_check
autocmd!
autocmd BufWritePost <buffer> silent make! -c % | redraw!
augroup END
endif