This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## git-publish-branch: a simple script to ease the unnecessarily complex | |
## task of "publishing" a branch, i.e., taking a local branch, creating a | |
## reference to it on a remote repo, and setting up the local branch to | |
## track the remote one, all in one go. you can even delete that remote | |
## reference. | |
## | |
## Usage: git publish-branch [-d] <branch> [repository] | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sphinx < Formula | |
desc "Full-text search engine" | |
homepage "http://www.sphinxsearch.com" | |
url "http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz" | |
sha256 "6662039f093314f896950519fa781bc87610f926f64b3d349229002f06ac41a9" | |
head "https://github.com/sphinxsearch/sphinx.git" | |
bottle do | |
sha256 "b890cf523db9777c7d125842fd6b0a53fe9a7a5a4cb816389ba6f5ee6483c78d" => :high_sierra | |
sha256 "55ce34bdedf13946fa614bde50839d93135eae720f1021e2c87807d04515ab18" => :sierra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
worlds['Beteigeuze'] = "~/minecraft-saves/Beteigeuze" | |
outputdir = "/var/www/Kornelius-Kalnbach/minecraft.murfy.de/Beteigeuze" | |
rendermode = "smooth_lighting" | |
def signFilter(poi): | |
if poi['id'] == 'Sign': | |
return "\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def markdown_h(input) | |
input.gsub(/^(?'hashtag'#+) (?'title'.*)/) do | |
level = [$~[:hashtag].size, 6].min | |
"<h#{level}>#{$~[:title]}</h#{level}>" | |
end | |
end | |
def markdown_em(input) | |
input.gsub(/\*(?'text'\S+)\*/) do | |
"<em>#{$~[:text]}</em>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
source = ARGV.first or raise 'need a file name' | |
basename = File.basename(source) | |
target = File.join File.dirname(source), (basename[/^_/] ? '_old' : 'old_') + basename | |
exec "git show master:#{source} > #{target}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Human | |
def self.speak what | |
what | |
end | |
end | |
class Pirate < Human | |
def self.speak what | |
proc { super }.call | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function srtTimeToSeconds(time) { | |
var match = time.match(/(\d\d):(\d\d):(\d\d),(\d\d\d)/); | |
var hours = +match[1], | |
minutes = +match[2], | |
seconds = +match[3], | |
milliseconds = +match[4]; | |
return (hours * 60 * 60) + (minutes * 60) + (seconds) + (milliseconds / 1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo < BasicObject | |
def test_block_given? | |
block_given? | |
end | |
private | |
def method_missing(method, *args, &block) | |
3.send(method, *args, &block) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Math | |
class << self | |
def fac n | |
return 1 if n < 2 | |
(1..n).inject { |prod, i| prod * i } | |
end | |
def choose n, k | |
fac(n) / (fac(n-k) * fac(k)) | |
end |
NewerOlder