The following rules of programming style are excerpted from the book "The Elements of Programming Style" by Kernighan and Plauger, published by McGraw Hill. Here is quote from the book: "To paraphrase an observation in The Elements of Style by Strunk and White, the rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules."
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
#header { | |
position:relative; | |
width:960px; | |
padding-bottom:25px; | |
} | |
#header p{ | |
text-transform:uppercase; | |
} |
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
module AuthlogicModel | |
def self.included(model) | |
model.class_eval do | |
extend ClassMethods | |
include InstanceMethods | |
include ProtectedAttributes | |
field :username | |
field :email | |
field :crypted_password |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="Author" content="Dream Deals Inc" /> | |
<meta name="Descripction" content="A Website store" /> | |
<meta name="Keywords" content="shop, store" /> | |
<meta name="Robots" content="index,follow" /> | |
<link href="estilo.css" rel="stylesheet" type="text/css" media="screen" /> | |
<title>Dream Deals</title> |
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
<?php // Manual de PHP de WebEstilo.com | |
if(isset($_POST['agregar'])){ | |
session_start(); | |
session_register('itemsEnCesta'); | |
$item=$_GET['id']; | |
$cantidad=$_POST['cant']; | |
$itemsEnCesta=$_SESSION['itemsEnCesta']; | |
if ($item){ | |
if (!isset($itemsEnCesta)){ |
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
for (var i=0; i < 100000; i++) { | |
db.mass_insert.save({ | |
"first_name": "James", | |
"middle_name": "Richard", | |
"last_name": "Windsgate", | |
"email": "[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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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
class AssetsCompiler < Sprockets::StaticCompiler | |
def precompile(paths) | |
ensure_clean_git | |
Rake::Task["assets:clean"].invoke | |
super | |
commit_compiled_assets | |
push | |
end | |
def ensure_clean_git |
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
gem 'rails', :git => 'git://github.com/rails/rails.git', :ref => 'c1f397f82c7b3f352500832a399b5dbdc500b9c8'# change as required | |
require 'active_record' | |
require 'logger' | |
# Show ActiveRecord log output | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
# Print out what version we're running | |
puts "Active Record #{ActiveRecord::VERSION::STRING}" |
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
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
OlderNewer