Skip to content

Instantly share code, notes, and snippets.

View danielres's full-sized avatar

Daniel Reszka danielres

  • Pixarea studio
  • Germany
View GitHub Profile
@danielres
danielres / auto_refresh.ahk
Created January 24, 2011 12:53
This autohotkey script refreshes the browser window automatically when saving a file
; USAGE:
; 1. Install autohotkey.
; 2. Install the Firefox extension "CSS Reloader".
; 3. Save this script anywhere on your computer.
; 4. Open your website in Firefox.
; 5. In this script, replace "Expresto - Mozilla Firefox" with the title of the Firefox window you want to auto-refresh.
; 6. Run this script, it stays in the backgound.
; 7. Edit your website inside your preferred text editor or IDE.
; 8. Now, save your work, but instead of ctrl+s, use ctrl+alt+s (or altgr+s) and see Firefox refreshing stylesheets automagically in the background.
@danielres
danielres / VMonMaximizeWnd3.vbs
Created January 23, 2011 17:31
ultramon script to maximize window on virtual monitor
'script configuration:
'the coordinates of each monitor, either of the full screen area or parts of it, need to be specified, ordered from left to right.
'to take taskbars and desktop toolbars into account when maximizing or moving a window, specify the workspace coordinates instead of
'the screen coordinates. both types of coordinates are shown for each monitor under UltraMon menu > About
'
'sample script configuration:
'two monitors at 1024x768, the first monitor is split in a left and right half, the second monitor isn't split:
'MONITORS = Array("0,0,512,768","512,0,1024,768","1024,0,2048,768")
Option Explicit
@danielres
danielres / DRY database.yml
Created January 9, 2011 23:32
random personal notes and reminders related to my funny adventures with Rails
# inheritance in yml files:
development: &defaults
adapter: mysql
encoding: utf8
database: acme_development
username: root
test:
<<: *defaults
@danielres
danielres / ubuntu_server_config.sh
Created January 9, 2011 00:04
steps used to install a rails environment for development on my Ubuntu 10.10 server box
# based on:
# http://www.hackido.com/2010/12/install-ruby-on-rails-on-ubuntu.html
# http://thekindofme.wordpress.com/2010/10/24/rails-3-on-ubuntu-10-10-with-rvm-passenger-and-nginx/
# http://ascarter.net/2011/01/02/rails-development-on-ubuntu-10.10.html
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install build-essential
sudo apt-get install git-core
## based on the example at:
## http://gist.github.com/17371
##
## put me in lib/un_haml.rb (in the haml-based project)
##
## call me on the command line thus:
## $ script/runner UnHaml app/views/layouts/application.html.haml
## $ script/runner UnHaml */*/*/*.haml
##
class UnHaml < Haml::Engine
@danielres
danielres / database.yml
Created January 1, 2011 17:46
rails: read password data from a text file
production:
adapter: mysql
database: my_db
username: db_user
password: <%= begin IO.read("/home/my_deploy_user/.db") rescue "" end %>
@danielres
danielres / .htaccess
Created December 29, 2010 10:45
generate functional rails app on hostingrails
# General Apache options
# AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
@danielres
danielres / erb2haml.rb
Created December 22, 2010 23:01
A little script to convert all your .erb views to .haml using html2haml, which is included with Haml installation. Just drop this in your rails root folder and run it. source: http://snippets.dzone.com/posts/show/5449
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
@danielres
danielres / simple_blog_schema.rb
Created November 29, 2010 22:34
Just a simple DB schema for a rails simple blog
ActiveRecord::Schema.define(:version => 20101119175732) do
create_table "categories", :force => true do |t|
t.string "name"
t.string "shortname"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "categories_posts", :id => false, :force => true do |t|
<p>
<a href="/signup/" class="multiline_button blue" style="width: 245px">
<big>Start Free Trial</big>
<small>30-days free! Signup in 60 seconds</small>
</a>
</p>
<p>
<a href="/signup/" class="multiline_button brown" style="width: 245px">
<big>Start Free Trial</big>