View todo.jsx
var React = require("react");
var allItems = []
allItems.push("Buy ingredients for Crock Pot");
allItems.push("Pick up chair at IKEA");
allItems.push("Go see mom");
class TodoList extends React.Component {

Tested with Chrome, Firefox and Safari.

The following code will not trigger an alert. target.innerHTML = "<script> alert('XSS Attack'); </script>";

The following code will trigger an alert. target.innerHTML = "<img src=x onerror=\"alert('XSS Attack')\" >";

# The main issues with Ruby 1.8.7 are that it won't build with Clang,
# and the Net::HTTPS module won't work with modern versions of OpenSSL.
# This assumes you have already set up homebrew, and run: xcode-select --install
#brew install homebrew/dupes/apple-gcc42
#brew install libyaml libffi
brew install
export CC=/usr/local/bin/gcc-4.2
View application_controller.rb
class ApplicationController < ActionController::Base
def handle_unverified_request
raise ActionController::InvalidAuthenticityToken

#Node.js and the Event Loop

Node.js is a framework for writing server-side JavaScript applications. It is built on top of the V8 JavaScript runtime and uses an event-driven, non-blocking I/O model that makes it perfectly suited for data-intensive real-time applications.

This blog post will describe what non-blocking I/O means and how working with the event loop can help your applications be more efficient.

##The Restaurant

"This [non-blocking I/O] model simplifies access to slow resources in a scalable way that is intuitive to JavaScript programmers and easy to learn for everyone else." - Node Up and Running.

View import_from_wp.rake
desc 'import from WordPress XML file'
task :import_from_wp => :environment do
require 'hpricot'
doc = Hpricot::XML('wp-export-file.xml'))
posts = (doc/:channel/:item)
posts.each do |post|
p "Post: #{'link').inner_text}"
View cart.exs
# from ounce of elixir
defmodule CartTest do
use ExUnit.Case
test "starts with empty count" do
assert Cart.count_items([]) == 0
View datetime.exs
defmodule CreditCard do
def current_amount_due(charges, apr, due_date, current_date \\ date_now()) do
# then proceed with calculation..
defp date_now do
DateTime.utc_now |> DateTime.to_unix
View a-main.go
package main
import (
func main() {
connections := lib.GetAllConnections()
var wg sync.WaitGroup
View main.go
package main
import (
func main() {