Skip to content

Instantly share code, notes, and snippets.

@dnshl
dnshl / .vimrc
Created June 2, 2019 21:34
vimrc
" Use vim settings, rather then vi settings (much better!)
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off " required for vundle
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
A good architecture maximizes the number of decisions NOT made. - Robert Martin
#!/usr/bin/env ruby
require 'FileUtils'
url = 'http://feeds.feedburner.com/simpledesktops\?format\=xml'
dir = Dir.home + '/Pictures/Wallpaper/'
FileUtils.mkdir_p(dir) unless Dir.exists?(dir)
wallpapers = `curl -s #{url} \
| grep .static \
@dnshl
dnshl / Rakefile
Created November 21, 2012 15:27
Rake Task with XMLFormatter for cucumber and XSLT Document
require 'gherkin/parser/parser'
require 'gherkin/formatter/json_formatter'
require 'stringio'
require "active_support/core_ext/hash/conversions"
require 'nokogiri'
class XMLFormatter < Gherkin::Formatter::JSONFormatter
def done
@io.write(@feature_hashes.to_xml)
end
@dnshl
dnshl / remove-all-gems
Created November 13, 2012 10:43
Remove all gems
gem list --no-versions | xargs gem uninstall -aIx
@dnshl
dnshl / serve.rb
Created July 18, 2012 18:34
Ruby HTTP Server for local Dir
require 'webrick'
def serve
dir = Dir::pwd
port = 12000 + (dir.hash % 1000)
s = WEBrick::HTTPServer.new(
:Port => port,
:DocumentRoot => dir
)
@dnshl
dnshl / emailTemplate.rb
Created February 29, 2012 13:29
Ruby SMTP email template
#!/usr/bin/env ruby
require 'net/smtp'
from = ""
to = ""
smtp_server = ""
port = 25
username = ""
@dnshl
dnshl / checkSite.sh
Created February 29, 2012 13:29
Bash script checks http status code
#!/bin/bash
URL=$1
RESPONSE=$(curl --write-out %{http_code} --silent --output /dev/null ${URL})
if [ $RESPONSE -ne 200 ]
then
echo $1 is down
fi
@dnshl
dnshl / trailing_slashes.rb
Created February 22, 2012 18:41
Tailing slashes in rails 3 applications
# Put this in your application.rb file under the config directory in your rails 3 app.
# Found here http://stackoverflow.com/a/9088501
config.action_controller.default_url_options = { :trailing_slash => true }
@dnshl
dnshl / drop-down-navigation.html
Created December 17, 2011 22:51
Simple CSS drop down navigation
<!DOCTYPE html>
<html lang="de">
<head>
<title>drop-down-navigation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
/* http://meyerweb.com/eric/tools/css/reset/ v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,