This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.read_files_and_create_reports | |
@filenames = [] | |
pids = [] | |
dir = "public/txt_reports" | |
Dir.foreach(dir) do |entry| | |
if entry.include? ".txt" | |
@filenames << entry | |
end | |
end | |
do_work_concurrently(@filenames, dir, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is neat. Here is my erb file. | |
<% content_for :sidebar do %> | |
<%= link_to 'New user', new_user_path %> | |
<% end %> | |
<h1>Listing users</h1> | |
<% @users.each do |user| %> | |
<% if user.sessions.size > 0 %> | |
<p class="logged_in"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
This is a smashup by Justin Richter of html.lang and ruby.lang | |
html.lang | |
Authors: Marco Barisione, Emanuele Aina | |
Copyright (C) 2005-2007 Marco Barisione <[email protected]> | |
Copyright (C) 2005-2007 Emanuele Aina | |
ruby.lang | |
Author: Archit Baweja <[email protected]> | |
Copyright (C) 2004 Archit Baweja <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Emacs Rails | |
C-c n Goto Mailer | |
C-c z '' RSpec Fixture | |
C-c x '' Fixture | |
C-c c '' Controller | |
C-c g '' Migration | |
C-c r '' RSpec | |
C-c u '' Unit Test | |
C-c m '' Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- | |
# Excerpted from "Programming Ruby 1.9", | |
# published by The Pragmatic Bookshelf. | |
# Copyrights apply to this code. It may not be used to create training material, | |
# courses, books, articles, and the like. Contact us if you are in doubt. | |
# We make no guarantees that this code is fit for any purpose. | |
# Visit http://www.pragmaticprogrammer.com/titles/ruby3 for more book information. | |
#--- | |
# I modified this code a little |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def do_work_concurrently(number_of_workers = 5) | |
config = ActiveRecord::Base.remove_connection | |
max = number_of_workers | |
pids = [] | |
any_work = true | |
while any_work do | |
# Don't forget to set any_work to false to exit the loop | |
pids << fork_with_new_connection(config) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Load a custom theme | |
(load-theme 'sanityinc-tomorrow-eighties t) | |
;; Make compilation window not steal a buffer | |
(setq special-display-buffer-names | |
'("*compilation*")) | |
(setq special-display-function | |
(lambda (buffer &optional args) | |
(split-window) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# justin.zsh-theme | |
# Most of this was taken from | |
# http://blog.andrewhays.net/love-your-terminal which was taken from | |
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ | |
# Also some of this was taken from josh.zsh-theme | |
# Determine what character to use in place of the '$' for my prompt. | |
function repo_char { | |
git branch >/dev/null 2>/dev/null && echo "%(?,%{%F{green}%},%{%F{red}%})∩%{$reset_color%}" && return | |
echo "%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html, <title>Ruby Mode Text Editor</title><style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; CSS search if there are open buffers | |
(defun search-open-css-buffers-for-region-or-word () | |
"Use the current region/point and search open css buffers" | |
(interactive) | |
(let (searchTerm) | |
(setq searchTerm | |
(if (region-active-p) | |
(buffer-substring-no-properties (region-beginning) (region-end)) | |
(thing-at-point 'symbol))) | |
(multi-occur (mapcar (lambda (buf) |
OlderNewer