Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Medge's Bean Chili

A really hot one and best served with corn chips! Found it in Open Source Cookbook in my favorite recipe organizer.
Haven't tried it with the dry white wine yet :P

INGREDIENTS
2 large onions, diced
1 tsp   minced garlic
1 tsp   minced ginger
1 whole red bell pepper, diced
1 tbsp  basil leaves
1 tbsp  mixed herbs
1 can	(10 oz) tomatoes
1 can	(10-14 oz) kidney beans, drained


DIRECTIONS
1. Fry peppers, garlic, and onions in a sauté pan until the onions begin to turn soft. 
2. Add tomatoes (with juice), beans, and herbs.
3. Reduce heat, and simmer for at least 30 mins (more is better)
4. Serve with rice, yogurt, and corn chips (or all of these), and Alacante, any clear dry white wine, or even frontinac.

How to ssh into Ubuntu on Parallels by hostname

this is something that strangely doesn't happen automatically on ubuntu
in Ubuntu, just add
send host-name "dapperbox";

to your /etc/dhcp3/dhclient.conf file

you might need to do a
sudo /etc/services/networking restart


On your Mac, you can now do
ssh username@dapperbox


instead of

ssh username@1.2.3.4

My mom's recipe for okroshka (cold soup)

Ingredients:
Bunch of spring onions
0.5 kg of cucumbers 
4 potatoes
5 eggs
Bunch of fennel
1 carrot
3 garlics
0.5 kg of a boiled sousage
Sour cream
1L of kefir


Boil water and let it to get cold.
Put all sour cream and kefir there.
Boil 4 not so small potatoes and 1 carrot.
Boil 5 eggs and then put them under cold water.
While everything is boiling crumble cucumbers, spring onions (only green part), a fennel, garlics and a sousage.
Let potatoes and a carrot to get cold and then crumble them too.
Put everything into the water.
Salt and pepper to your taste.
Put it into a refrigerator and let it to get really cold.

Bon appetit!

DRY up empty controller actions

Ever create Rails views that don't user the controller at all just to take advantage of an application layout?
If you have, you may have a lot of code that looks like this:


class HelpController < ApplicationController
  def index
  end

  def tutorial
  end

  def faq
  end
end


Well, there's a simple way to make this a lot cleaner...


class ApplicationController < ActionController::Base
  def self.simple_action(*actions)
    actions.each {|action| class_eval("def #{action}; end")}
  end
end

Now your controller can look like this instead...

class HelpController < ApplicationController
  simple_action :index, :tutorial, :faq
end

Quickly concatenating PDF files with teTeX utilities

Using utilities from the standard teTeX distribution, it's possible to quickly and easily concatenate multiple pdfs together from the command line.

To concatenate 1.pdf, 2.pdf, 3.pdf into a single file 123.pdf you can use the command

texexec --pdfarrange --result 123.pdf 1.pdf 2.pdf 3.pdf


To concatenate all pdf files in a directory into a single file all.pdf you can use

texexec --pdfarrange --result all.pdf *.pdf

Real good Granola

- Ingredients:

3 cups rolled oats
1 1/4 cups bran flakes
3/4 cup shredded coconut
1/2 cup walnuts
1 cup sliced almonds
3/4 cup salted sunflower seeds
2 teaspoons cinnamon
2 1/2 teaspoons pure maple syrup
honey (1/3-1/2 cup depending on taste)
canola oil (1/3-1/2 cup)

Preheat oven to 350 degrees. Cover baking sheets with wax paper and grease with cooking spray. Combine oats, bran flakes, coconut, walnuts, almonds, sunflower seeds, and cinnamon in a large bowl. Mix maple syrup, honey and oil in small bowl; add to dry mixture and stir until well mixed. Spread on cookie sheet(s) and bake for 20-25 minutes until golden brown, tossing granola halfway through baking time to keep edges from burning. Cool completely before storing.

Good Eats Roast Turkey

Recipe courtesy Alton Brown
Show: Good Eats
Episode: Romancing the Bird (A Good Eats Thanksgiving)

1 (14 to 16 pound) frozen young turkey
For the brine:
1 cup kosher salt
1/2 cup light brown sugar
1 gallon vegetable stock
1 tablespoon black peppercorns
1/2 tablespoon allspice berries
1/2 tablespoon candied ginger
1 gallon iced water
For the aromatics:
1 red apple, sliced
1/2 onion, sliced
1 cinnamon stick
1 cup water
4 sprigs rosemary
6 leaves sage
Canola oil

Combine all brine ingredients, except ice water, in a stockpot, and bring to a boil. Stir to dissolve solids, then remove from heat, cool to room temperature, and refrigerate until thoroughly chilled.
Early on the day of cooking, (or late the night before) combine the brine and ice water in a clean 5-gallon bucket. Place thawed turkey breast side down in brine, cover, and refrigerate or set in cool area (like a basement) for 6 hours. Turn turkey over once, half way through brining.
A few minutes before roasting, heat oven to 500 degrees. Combine the apple, onion, cinnamon stick, and cup of water in a microwave safe dish and microwave on high for 5 minutes.
Remove bird from brine and rinse inside and out with cold water. Discard brine.
Place bird on roasting rack inside wide, low pan and pat dry with paper towels. Add steeped aromatics to cavity along with rosemary and sage. Tuck back wings and coat whole bird liberally with canola (or other neutral) oil.
Roast on lowest level of the oven at 500 degrees F. for 30 minutes. Remove from oven and cover breast with double layer of aluminum foil, insert probe thermometer into thickest part of the breast and return to oven, reducing temperature to 350 degrees F. Set thermometer alarm (if available) to 161 degrees. A 14 to 16 pound bird should require a total of 2 to 2 1/2 hours of roasting. Let turkey rest, loosely covered for 15 minutes before carving.

(c) Food Network, Alton Brown

Gingered Sweet Potato Puree

Recipe courtesy Sara Moulton

2 tablespoons butter
1 cup chopped onions
8 medium sweet potatoes
3/4 cup milk
4 tablespoons butter
1/4 cup candied ginger, chopped, or to taste

Saute onions in butter until translucent. Set aside. Peel potatoes and cut into 1-inch pieces. Place potatoes in saucepan with cold salted water to cover and boil, covered, until very tender, about 15 minutes. Drain in colander. In a food processor, puree potatoes, milk, butter and Sauteed onions until smooth. Season with salt and pepper. Sprinkle with chopped candied ginger.

(c) Food Network, Sara Moulton

Fried mac 'n' cheese

Recipe Summary
Difficulty: Easy
Prep Time: 20 minutes
Cook Time: 5 minutes

Leftover baked macaroni and cheese, refrigerated for at least overnight
1 cup all-purpose flour
1 teaspoon salt
1 teaspoon pepper
1 teaspoon cayenne
1 egg beaten with 2 ounces water
1 cup panko bread crumbs
Oil for deep frying, preheated to 375 degrees

Cut refrigerated macaroni and cheese into slices or bite size pieces.
Season the flour with salt, pepper and cayenne. Dredge each piece through the flour and gently tap off excess. Dip in the egg wash and then coat with the bread crumbs. Allow them to rest for 5 minutes so the crust can set. Very carefully drop into the oil and fry until golden brown. Remove to a baking sheet fitted with a rack and rest for 2 minutes before serving.

(c) Food Network, Alton Brown

The Chewy

Recipe Summary
Prep Time: 20 minutes
Cook Time: 15 minutes
Yield: 2 1/2 dozen cookies

2 sticks unsalted butter
2 1/4 cups bread flour
1 teaspoon kosher salt
1 teaspoon baking soda
1/4 cup sugar
1 1/4 cups brown sugar
1 egg
1 egg yolk
2 tablespoons milk
1 1/2 teaspoons vanilla extract
2 cups semisweet chocolate chips
Hardware:
Ice cream scooper (#20 disher, to be exact)
Parchment paper
Baking sheets
Mixer


Heat oven to 375 degrees F.
Melt the butter in a heavy-bottom medium saucepan over low heat. Sift together the flour, salt, and baking soda and set aside.

Pour the melted butter in the mixer's work bowl. Add the sugar and brown sugar. Cream the butter and sugars on medium speed. Add the egg, yolk, 2 tablespoons milk and vanilla extract and mix until well combined. Slowly incorporate the flour mixture until thoroughly combined. Stir in the chocolate chips.

Chill the dough, then scoop onto parchment-lined baking sheets, 6 cookies per sheet. Bake for 14 minutes or until golden brown, checking the cookies after 5 minutes. Rotate the baking sheet for even browning. Cool completely and store in an airtight container.

(c) Food Network, Alton Brown