This file contains hidden or 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
1.upto(100) do |i| | |
string = "" | |
string+= "Fizz" if i % 3 == 0 | |
string+= "Buzz" if i % 5 == 0 | |
string+= i.to_s if string.empty? | |
puts string | |
end |
This file contains hidden or 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
$(document).ready(function(){ | |
//$('form input[type="text"]:first').attr("tabindex", 1); | |
var first_field = ($('form input[type="text"]:first').attr('name')); | |
var form = ($('form:first').attr('id')); | |
//alert (form + "- " + first_field); | |
if (first_field == "task[due_date]") { | |
$('form textarea:first').focus(); | |
} | |
else | |
{ |
This file contains hidden or 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
<% if Rails.env != "production" %> | |
<div id="staging-server" style="background: #000; text-align: center; color: #FFF; font-size: 16px; font-weight: bold; text-transform: none; padding: 10px 0;">You are currently using the <%= Rails.env.capitalize %> server</div> | |
<% end %> |
This file contains hidden or 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
login as root or sudo -s.. | |
1) apt-get update | |
2) apt-get upgrade | |
(probably need a reboot after this) | |
3) apt-get install gcc bison zlibc build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev libcurl4-openssl-dev git-core mysql-server libmysqlclient-dev | |
4) wget ruby source to local directory | |
5) tar -zxvf downloaded file | |
6) cd newly_created_ruby_directory | |
7) ./configure |
This file contains hidden or 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
<IfModule mod_fcgid.c> | |
AddHandler fcgid-script .php | |
DefaultMaxClassProcessCount 4 | |
DefaultInitEnv PHP_FCGI_MAX_REQUESTS 0 | |
DefaultInitEnv PHP_FCGI_CHILDREN 0 | |
FCGIWrapper /usr/bin/php-cgi .php | |
<Files *.php> | |
Options +ExecCGI | |
</Files> | |
</IfModule> |
This file contains hidden or 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
class Payment | |
attr_accessor :amount | |
def initialize (x) | |
self.amount = amount | |
end | |
def fee_amount | |
(((2.9 * (self.amount * 100)) / 100) + 15).round.to_f/100 | |
end |
This file contains hidden or 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
[root@dora video]# smartctl -a /dev/sdd | |
smartctl version 5.37 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen | |
Home page is http://smartmontools.sourceforge.net/ | |
=== START OF INFORMATION SECTION === | |
Device Model: ST31000528AS | |
Serial Number: 5XXXXXXX | |
Firmware Version: CC44 | |
User Capacity: 1,000,204,886,016 bytes | |
Device is: Not in smartctl database [for details use: -P showall] |
This file contains hidden or 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
class MyModel < ActiveRecord::Base | |
def self.columns | |
@columns ||= [] | |
end | |
def self.column(name, sql_type = nil, default = nil, null = true) | |
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, | |
sql_type.to_s, null) | |
end |
This file contains hidden or 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
# the usual disclaimers apply, this may or may not work for you, and it's rather hacky, but works for me(tm) :) | |
# first parse the mail | |
mail = TMail::Mail.parse(params[:email]) | |
# parse the mail (as below) | |
email.body = Email.get_multipart_body(mail) | |
# in your model... |
This file contains hidden or 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
CACHE = MemCache.new(:namespace => "cheese") | |
CACHE.servers = '127.0.0.1:11211' |