Skip to content

Instantly share code, notes, and snippets.

View superchris's full-sized avatar

Chris Nelson superchris

View GitHub Profile
(define (cubert x)
(define (improve guess x)
(/
(+ (/ x (* guess guess)) (* 2 guess))
3)
)
(define (cube x)
(* x x x))
(define (good-enough? guess x)
>> Redis::VERSION
Redis::VERSION
=> "2.0.1"
>> r = Redis.new
r = Redis.new
=> #<Redis:0x8777470 @client=#<Redis::Client:0x877740c @host="127.0.0.1", @password=nil, @timeout=5, @sock=nil, @logger=nil, @db=0, @port=6379>>
>> redis.set "test1", "foo"
redis.set "test1", "foo"
>> r.set "test1", "foo"
r.set "test1", "foo"
>> Redis::VERSION
Redis::VERSION
=> "2.0.1"
>> r = Redis.new
r = Redis.new
=> #<Redis:0x8777470 @client=#<Redis::Client:0x877740c @host="127.0.0.1", @password=nil, @timeout=5, @sock=nil, @logger=nil, @db=0, @port=6379>>
>> redis.set "test1", "foo"
redis.set "test1", "foo"
>> r.set "test1", "foo"
r.set "test1", "foo"
require File.dirname(__FILE__) + '/../test_helper'
class JSpecTest < ActionController::IntegrationTest
include Capybara
def setup
@wait_time = Capybara.default_wait_time
Capybara.default_wait_time = 15
end
<script>
function runSuites() {
// uncomment when we move away from the grammar
//JSpec.preprocess = function(code) { return code; }
var matches = /.*\?test=(.*)/.exec(document.URL);
if (matches)
{
JSpec
.exec(matches[1])
@superchris
superchris / foo
Created September 28, 2010 18:36
class GotsController < ApplicationController
def new
@got = Got.new
end
def create
@got = Got.new(params[:got])
@got.user = current_user
if @got.save
%div
.content-title
%h2.secondary Profit Over Last 3 Months
.widget_container
#no_data_pnl
%div
%div{ :style => "margin-left: 120px;"}
%h3
You have no transactions in Outright.
%p
require 'java'
java_import javax.xml.XMLConstants
java_import javax.xml.transform.Source
java_import javax.xml.transform.stream.StreamSource
java_import javax.xml.validation.SchemaFactory
java_import javax.xml.validation.Schema
java_import javax.xml.validation.Validator
schema_factory = SchemaFactory.new_instance(XMLConstants::W3C_XML_SCHEMA_NS_URI)
class FooView extends Backbone.View
id: "taxonomy-tree"
events:
"move_node.jstree": "moveNode"
moveNode: ->
debugger
new FooView()
@superchris
superchris / jasmine.jquery.load_template.js
Created March 14, 2011 02:07
spec helper function that loads a view template into the jasmine jquery fixture
jasmine.Fixtures.prototype.loadTemplate_ = function(template) {
var templateUrl = "/backbone/templates/" + template;
var self = this;
$.ajax({
async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
cache: false,
dataType: 'html',
url: templateUrl,
success: function(data) {
$('#' + self.containerId).append(data);