Skip to content

Instantly share code, notes, and snippets.

Stefan Wienert zealot128

Block or report user

Report or block zealot128

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zealot128 /
Last active Aug 29, 2015
Bootstrap-modal with ajax links. Just put class js-modal on links. All links inside that modal and the form are submitted remotly
$ ->
$(document).on 'click', '.js-modal, #js-modal .modal-body a', (e)->
return true if $(this).data('toggle')
modal = """
<div class='modal fade container' id='js-modal' role="dialog" >
<div class='no-modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
zealot128 / db.rb
Last active Aug 29, 2015
ActiveRecord Sqlite auto connection + migration without Rails in one file (AR 4)
View db.rb
require 'active_record'
require 'fileutils'
ActiveRecord::Base.logger =
db = "db/#{ENV['RACK_ENV']}.sqlite3"
if not File.exists? db
`sqlite3 #{db} '' `

Keybase proof

I hereby claim:

  • I am zealot128 on github.
  • I am stefanwienert ( on keybase.
  • I have a public key whose fingerprint is DB9A C627 56EF 892A 35D9 727E 2630 9489 C29F E67F

To claim this, I am signing this object:

zealot128 /
Created Oct 18, 2011
pludoni Capistrano Deploy script


cap deploy:setup
# will create shared dir's and symlinks for assets
#  db, log and "public/system"
cap deploy
# Let's go
zealot128 /
Created Dec 16, 2011
Ruby - HTML Tagcloud with easy changeable formular

Tagcloud Calculation


Calculate weight of given array. e.g. %w[ruby ruby ruby rails]

Tagcloud.tagcloudize [ "rails", "ruby", "rails" ...] do |count,max|
zealot128 /
Created Dec 16, 2011
Easy XML Sitemap with rails (little work involved anyway)

Sitemap XML with Rails

Rails is too custom, to provide a generic sitemap as a gem for any situation. But it ist not too hard anyway! Here is a frame how to make one:

rails g controller sitemap
zealot128 /
Created Mar 12, 2012
Drupal 7 Installation with compass configuration
# Download latest Drupal
tar xf drupal-$version.tar.gz
mv drupal-$version/.* . -f
mv drupal-$version/* .
rm drupal-$version.tar.gz -rf drupal-$version
rm *txt -f
wget -O profiles/standard/translations/
chown www-data\: sites/default/ -R
zealot128 / download_file.rb
Created Jul 22, 2012
Download an URL with open-uri to paperclip
View download_file.rb
# encoding: utf-8
def download_url(url)
url.gsub!(" ","%20")
# TODO better escaping of stuff like umlauts
# url.gsub!("ö","%C3%B6")
logo_path = url.split("/").last
io = open(url)
io.define_singleton_method(:original_filename) do
zealot128 / config.rb
Created Nov 28, 2012
Earthquake - Show replies to a tweet
View config.rb
# paste into ~/.earthquake/config
Earthquake.init do
command :replies do |m|
thread = [twitter.status(m[1])]
r = twitter.get "/related_results/show/#{273873995647045633}.json"
results = r.first["results"].map{|i|i["value"]}
results.reverse_each.with_index do |t,i|
t["_mark"] = config[:thread_indent] * i
zealot128 /
Last active Nov 11, 2015
Favicon generation + Example integration in rails view

Needs imagemagick + pngquant

  • put a high res (at least 310x310) favicon_logo_big.png in the same folder as,
  • run it bash
  • move the bunch into your assets folder, e.g. app/assets/images/favicons
  • See the attached application.slim for example on how to link it.
You can’t perform that action at this time.