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
(defn unless [test expr] (if-not (eval test) (eval expr))) | |
(prn (unless (odd? 11) (str "it's good to be " 11))) | |
(prn (unless (odd? 12) (str "it's good to be " 12))) | |
(defn only-if-even [x] (unless (odd? x) (str "it's good to be " x))) | |
(prn (str 6 " " (only-if-even 6))) | |
(prn (str 5 " " (only-if-even 5))) |
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 HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>JQuery Selectors</title> | |
</head> | |
<body> | |
<p>$("p") selects all <p> elements.</p> | |
<p>$("p.intro") selects all <p> elements with class="intro".</p> |
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
<project name="sqlite" basedir="." default="echo"> | |
<property name="sqldriver.jar" value="${user.home}/dev/bin/sqlite/sqlitejdbc-v056.jar"/> | |
<property name="db.name" value="programmers.db"/> | |
<property name="url" value="jdbc:sqlite:data"/> | |
<property name="driver" value="org.sqlite.JDBC"/> | |
<property name="userid" value="root"/> | |
<property name="password" value="root"/> | |
<target name="echo"> |
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
-- start the server: $ mysqld --console | |
-- login: $ mysql -u root --password=wxyz | |
-- run the script: mysql> source /Users/javapro/dev/src/sql/Cookbook.sql | |
-- the script: | |
drop database if exists Cookbook; | |
create database Cookbook; | |
connect Cookbook; |
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
create database MovieEngagement; | |
connect MovieEngagement; | |
create table Theater ( | |
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
name VARCHAR(50) NOT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
create table Screen ( |
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
var http = require('http') | |
, mysql = require('mysql'); | |
var client = mysql.createClient({ | |
user: 'root', | |
password: '' | |
}); | |
client.useDatabase('cookbook'); |
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
require 'java' | |
swing_classes = %w(JFrame JButton JList JSplitPane | |
JTabbedPane JTextPane JScrollPane JEditorPane | |
DefaultListModel ListSelectionModel BoxLayout | |
JScrollPane JTree tree.TreeModel | |
text.html.HTMLEditorKit tree.DefaultMutableTreeNode tree.TreeNode) | |
swing_classes.each do |c| | |
java_import "javax.swing.#{c}" | |
end |
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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" media="screen" | |
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css" /> | |
</head> | |
<body> | |
<p>Date: <input id=fromdt type=text></p> | |
<div style="display: none" class=demo-description></div> | |
<p>Date: <input id=todate type=text></p> | |
<div style="display: none" class=demo-description></div> |
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
require 'test/unit' | |
class Calc | |
def add(a,b) | |
6 | |
end | |
end | |
class TestAdd < Test::Unit::TestCase | |
def test_add |
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
require 'rubygems' | |
require 'shoulda' | |
require 'test/unit' | |
class Calc | |
def add(a,b) | |
6 | |
end | |
end |