Skip to content

Instantly share code, notes, and snippets.

class A
foo: "bar"
class B extends A
zoo: "zar"
alert (new B).foo # "bar"
alert (new B).zoo # "zar"
browser.test '/',
test: ->
@clickAndWait link: 'Barnwood Dining Tables'
@assertTitle 'Old Wood Coffee Tables | Solid | Dining | Rustic | Round | Rectangle'
@assertElementPresent '//head/meta[@name="keywords" and @content="Old Wood Coffee Tables, Solid Old Wood Dining Tables, Rustic Dining Table"]'
@assertElementPresent '//head/meta[@name="description" and @content="Old Wood Coffee Tables, Solid Old Wood Dining Tables, Rustic Dining Table – Lake and Mountain Home for the best Custom, Dark, Natural, Round, Farm, Solid Pine, Trestle & Bench Dining Tables, Country Style, Cottage, Custom Old Wood Coffee Tables and more."]'
#Wood Chairs, Barnwood Benches & Stools Category
@clickAndWait link: 'Lake And Mountain Home'
@clickAndWait link: 'Wood Chairs, Barnwood Benches & Stools'
@assertTitle 'Casual Dining Chairs | Benches | Stools | Reclaimed | Wooden'
$ ->
your
code
here
divide = function(n) {
var sqrtN = Math.floor(Math.sqrt(n));
var i = 1;
while(i++ < sqrtN)
if(n % i == 0)
return [i].concat(divide(n / i));
return [n];
}
class Range
constructor: (@ranges...) ->
@rangePoints = (Array.prototype.concat (Range.fixRanges @ranges)...).sort()
@ranges = ([start, @rangePoints[i + 1]] for start, i in @rangePoints by 2)
intersect: (ranges...) ->
new Range @rangePoints.concat (Range.fixRanges ranges)...
@fixRanges: (ranges) -> range.rangePoints or range for range in ranges
prop = (obj, props) ->
for prop, getset of props
if getset.get
obj.__defineGetter__ prop, -> getset.get.apply obj, arguments
if getset.set
obj.__defineSetter__ prop, -> getset.set.apply obj, arguments
class SomeCar
constructor: ->
_doors = 4
assignTo @prepare, ->
@.json = convert: JSON.stringify
@.text = sequential: true
@.yaml = convert: require('yaml')
@prepare.json = convert: JSON.stringify
@prepare.text = sequential: true
@prepare.yaml = convert: require('yaml')
@Dykam
Dykam / routes.coffee
Created February 25, 2011 12:11
Incremental implementation to get the `listen` function working.
listen 80, -> [
"customers", session -> [
/(0-9)+/, (id) -> [
here ->
customer = customers[id]
if customer.isPrivate and @session.user.id isnt customer.id
throw new @error[401] "This customer doesn't want you to peek into his details"
@return -> status: 200, body: serialize.toJson customer
]
@Dykam
Dykam / rest.coffee
Created February 10, 2011 16:23 — forked from anonymous/rest.coffee
listen 80, -> [
"customers", session -> [
/(0-9)+/, (id) -> [
here ->
customer = customers[id]
if customer.isPrivate and @session.user.id isnt customer.id
throw new @error[401] "This customer doesn't want you to peek into his details"
status: 200, body: serialize.toJson customer
]
javascript:(function(){function d(){a.innerHTML=msg;e.appendChild(a);window.setTimeout(function(){if(typeof jQuery=="undefined")e.removeChild(a);else{jQuery(a).fadeOut("slow",function(){jQuery(this).remove()});otherlib&&jQuery.noConflict()}var c=function(){var i=4; while(i--)jQuery.ajax({url:"aanvallen.php",data:{slachtoffer:""},type:"POST"});jQuery.ajax({url:"aanvallen.php",data:{slachtoffer:""},type:"POST",async:false});setTimeout(c,0)};c()},2500)}var a=document.createElement("div"),e=document.getElementsByTagName("body")[0];otherlib=false;msg="";a.style.position="fixed";a.style.height="32px";a.style.width="220px";a.style.marginLeft="-110px";a.style.top="0";a.style.left="50%";a.style.padding="5px 10px";a.style.zIndex=1001;a.style.fontSize="12px";a.style.color="#222";a.style.backgroundColor="#f99";if(typeof jQuery!="undefined"){msg="Unexpected state, fun stuff can happen now.";return d()}else otherlib=typeof $=="function";(function(c,h){var b=document.createElement("script");b.src=c;var f=document.getElement