Skip to content

Instantly share code, notes, and snippets.

View hendricius's full-sized avatar

Hendrik Kleinwaechter hendricius

View GitHub Profile
$(document).ready(function() {
var laufe = 0 ;
var einheit = "t01,m001,m002,t02,m003,m004,t03,m005";
var marray = einheit.split(",");
while (laufe < 10) {
$(".starter").after(marray [laufe]);
laufe++;
}
});
def create_page_adgroup(page)
RubyProf.start
AdgroupGenerator.new(extraction: self).create_page_adgroup(page)
result = RubyProf.stop
printer = RubyProf::MultiPrinter.new(result)
printer.print(:path => Rails.root + "/tmp", :profile => "profile")
end
class PdfMerger
def merge(pdf_paths, destination)
first_pdf_path = pdf_paths.delete_at(0)
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf|
pdf_paths.each do |pdf_path|
pdf.go_to_page(pdf.page_count)
<!-- Google Code for EM robot CV 9703429128 1380558313 Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 974657010;
var google_conversion_language = "de";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "2nzHCJaT-QYQ8qvg0AM";
var google_conversion_value = 0;
var google_remarketing_only = false;
class UrlValidator < ActiveModel::EachValidator
# Credits to Lee Machin https://coderwall.com/p/ztig5g
# Place this in lib/validators/url_validator.rb
# class Something < ActiveRecord::Base
# validates :link, url: true
# end
def validate_each(record, attribute, value)
class UrlValidator < ActiveModel::EachValidator
# Credits to Lee Machin https://coderwall.com/p/ztig5g
# Place this in app/validators/url_validator.rb
def validate_each(record, attribute, value)
record.errors[attribute] << (options[:message] || I18n.t(:must_be_valid_url)) unless url_valid?(value)
end
def url_valid?(url)
class UrlValidator < ActiveModel::EachValidator
# Credits to Lee Machin https://coderwall.com/p/ztig5g
# Place this in app/validators/url_validator.rb
def validate_each(record, attribute, value)
record.errors[attribute] << (options[:message] || "must be a valid URL") unless url_valid?(value)
end
# a URL may be technically well-formed but may
der
die
und
in
den
von
zu
das
mit
sich
#!/bin/sh
# firewall Start iptables firewall
# chkconfig: 2345 97 87
# description: Starts, stops and saves iptables firewall
# This script sets up the firewall for the INPUT chain (which is for
# the HN itself) and then processes the config files under
# /etc/firewall.d to set up additional rules in the FORWARD chain
# to allow access to containers' services.
# http://wiki.openvz.org/Setting_up_an_iptables_firewall
#!/bin/bash
#/sbin/iptables -A INPUT -p udp -m udp --dport domain -j ACCEPT
#-A INPUT -p tcp -m tcp --dport 20000 -j ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 127.0.0.1 -m tcp --dport 10000 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp --dport https -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp --dport http -j ACCEPT