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
zealot128 / modal-ajax.coffee
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
View modal-ajax.coffee
$ ->
$(document).on 'click', '.js-modal, #js-modal .modal-body a', (e)->
return true if $(this).data('toggle')
e.preventDefault()
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
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 = Logger.new(STDERR)
db = "db/#{ENV['RACK_ENV']}.sqlite3"
if not File.exists? db
`sqlite3 #{db} '' `
end
View keybase.md

Keybase proof

I hereby claim:

  • I am zealot128 on github.
  • I am stefanwienert (https://keybase.io/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
zealot128 / README.md
Created Oct 18, 2011
pludoni Capistrano Deploy script
View README.md

USAGE

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

Tagcloud Calculation

Usage

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

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

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
zealot128 / drush.sh
Created Mar 12, 2012
Drupal 7 Installation with compass configuration
View drush.sh
# Download latest Drupal
version="7.12"
wget http://ftp.drupal.org/files/projects/drupal-$version.tar.gz
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 http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.11.de.po -O profiles/standard/translations/drupal-7.11.de.po
chown www-data\: sites/default/ -R
@zealot128
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
logo_path
@zealot128
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
zealot128 / README.md
Last active Nov 11, 2015
Favicon generation + Example integration in rails view
View README.md

Needs imagemagick + pngquant

  • put a high res (at least 310x310) favicon_logo_big.png in the same folder as source.sh,
  • run it bash source.sh
  • 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.