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
raise "UseNewerRubyCauseHazPermutations" if RUBY_VERSION < "1.9.3" | |
%w["d3Vv", "dG5h", "QGVt"].permutation.to_a.map(&:join).each do |middle| | |
puts Base64.decode64( "ZWQubmVsaGF6cmFi" + middle + "eQ==").reverse | |
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
# Super easy finder fuer models mit einem Attribut :name | |
# | |
# Erweitert: | |
# | |
# Domain.itsax | |
# Domain.itmitte | |
# | |
# User.pludoni | |
# | |
# User["plu"] -> pludoni |
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
// wait 8 seconds between each download | |
waittime = 8000 | |
// only download links that are visible right now -> Fold old lectures | |
only_visible = true | |
ls=$.map($('.icon-download-alt'),function(a,e){link=$(a).parent();link.attr("target", "_blank");return link});if(only_visible) ls=ls.filter(function(a){return a.is(":visible")});function ex(){ls.shift().find("i").click();if(ls.length>0)setTimeout(ex, waittime)};ex() |
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
let g:rails_projections = { | |
\ "config/projections.json": { | |
\ "command": "projections" | |
\ }, | |
\ "app/services/*.rb": { | |
\ "command": "service", | |
\ "affinity": "model", | |
\ "test": "spec/services/%s_spec.rb", | |
\ "related": "app/models/%s.rb", | |
\ "template": "class %S\n\n def run\n end\nend" |
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
.two-click{data: { iframe: url, height: height, width: width} } | |
= link_to url, title: t("two-click.info"), target: "_blank", rel: "nofollow" do | |
= image_tag image_url, class: "two-click-img" |
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
@font-face { | |
font-family: "HelveticaNeue"; | |
src: url(data:font/truetype;charset=utf-8;base64,#{Base64.encode64(File.read("app/assets/fonts/helveticaneue-light-webfont.ttf")).gsub("\n","")}); | |
font-weight: normal; | |
font-style: normal; | |
} | |
body, h1, h2, h3 { |
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
# normal regex with unnamed groups -> JS/PHP,Pearl | |
/(\/v\/|\/embed\/|watch?.*v=)([A-Za-z0-9\-_]*)|youtu\.be\/([A-Za-z0-9\-_]*)/ | |
# normal regex with named groups | |
m = /(\/v\/|\/embed\/|watch?.*v=)(?<id>[A-Za-z0-9\-_]*)|youtu\.be\/(?<id>[A-Za-z0-9\-_]*)/ | |
m.match("http://youtu.be/fat9235")[:id] | |
# -> fat9235 | |
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 ExampleCrawler < PoltergeistCrawler | |
def crawl | |
visit "https://news.ycombinator.com/" | |
click_on "More" | |
page.evaluate_script("window.location = '/'") | |
end | |
end | |
ExampleCrawler.new.crawl |
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
ole_bin = File.open("...","rb") | |
# just look for PDF Marker and EOF Marker | |
pdf_bin = ole_bin[/(%PDF-.*%%EOF\r?\n)/m,1] |
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
augroup ansible_yaml | |
autocmd! | |
au BufRead playbook.yml,roles/*yml,ansible*yml call SetAnsibleOpts() | |
augroup END | |
function SetAnsibleOpts() | |
syntax match yamlInterpolate '$\w\+\|{{[^}]\+}}' | |
syntax match yamlInterpolate '$\w\+\|{{[^}]\+}}' contained containedin=yamlString | |
syntax match yamlConstant '\(with_items\|when\|name\|notify\|ignore_errors\|changed_when\|register\|with_password\):' | |
endfunction |