Skip to content

Instantly share code, notes, and snippets.

View evanwalsh's full-sized avatar
❤️‍🔥
You make me feel almost human

Evan Walsh evanwalsh

❤️‍🔥
You make me feel almost human
View GitHub Profile
# A model for Ruby on Rails that gets settings from a DB
# And it caches them! Success!
class Preference < ActiveRecord::Base
def self.get(name)
return Rails.cache.fetch(name) {
output = self.find_by_name!(name)
Rails.cache.write(name,output.value)
}
# Put this in routes.rb at the very bottom (right before end)
map.error '*path', :controller => 'application', :action => 'rescue_404'
# Put this in application.rb
rescue_from ActiveRecord::RecordNotFound, ActionController::UnknownAction, :with => :rescue_404
def rescue_404
render :template => "errors/404", :layout => "application", :status => "404"
#!/bin/bash
# Let's get a git repo on a host that doesn't have it
curl -L http://github.com/$1/$2/tarball/master -o $1-$2.tar.gz > /dev/null
echo "Download of tarball complete."
tar -xf $1-$2.tar.gz > /dev/null
rm $1-$2.tar.gz
echo "Untarring of tarball complete."
echo "Feel free to change to the new dir"
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
// C IS FOR COOKIE originally by Mislav Marohnić ( http://mislav.uniqpath.com/js/c-is-for-cookie/ )
// chopped and spliced by Evan Walsh
var Cookie = {
find: function(name){
var name = escape(name) + '='
if (document.cookie.indexOf(name) >= 0) {
var cookies = document.cookie.split(/\s*;\s*/)
for (var i = 0; i < cookies.length; i++) {
if (cookies[i].indexOf(name) == 0)
return unescape(cookies[i].substring(name.length, cookies[i].length))
# This helper method will either generate a regular link => <a href="/whatever">Whatever</a>
# or it will generate a link with a "current class => <a href="/whatever" class="current">Whatever</a>
# Easy, huh?
def link_to_or_current(name, options = {}, html_options = {})
link_to_unless_current(name, options, html_options) do
link_to(name, options, { :class => :current })
end
---
Title: Insomnia
What is the disorder?:
- Too little or poor quality sleep caused by:
- Significant life stress
- Illness
- Emotional or physical discomfort
- Environmental factors like: light, noise, extreme temperature
- Some medications
http://www.myspace.com/wearewhitenoise
http://djearworm.com/
http://hawkinsmashups.blogspot.com/
http://www.bootieusa.com/ (scroll down to BEST OF BOOTIE ALBUM DOWNLOADS)
Question One:
An East German's reaction would depend on one major factor: age. In either case, having bought into the system would make their reaction negative. However, if the person was old, the anguish would be exponential. Being completely sold out for the system and then having that system disentigrate would bring dissatisfaction like no other. Most of the negativity would stem from the deep hatred of the West and its ways. East Germany and West Germany, separated by a small wall, could not have been farther apart. The wall coming down would not be as hard on the younger socialists as much, though. Even though they will have bought into the socialist philosophy, their longevity as a socialist would be nearly null. Therefore, change would not be all that difficult for them. Although, any age would struggle with the intense change in daily life.
Question Two:
I think Germany is much better off as a single country. I think it was incredibly good that the wall fell when it did. The USSR hadn't quite disso
Evan Walsh
Mrs. Cumberworth
AP English
26 January 2010
Fear No Evil
The LORD is my shepherd, I shall not be in want.
He makes me lie down in green pastures, he leads me beside quiet waters,
He restores my soul. 
He guides me in paths of righteousness for his name's sake.