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
function throttle(fn, ms, scope) { | |
var last = 0; | |
var fn = function() { | |
var now = Date.now(); | |
if ( now - last > ms ) { | |
last = now; | |
fn.apply(scope, arguments); | |
} | |
}; | |
return scope ? fn.bind(scope) : fn; |
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
# About: | |
# Fetches plain text files of complete http responses | |
# and reconstructs them into the header and body parts | |
# | |
# Usage: | |
# require 'sinatra' | |
# require 'sinatra/responsefetcher' | |
# get "/" do | |
# fetchresponse('responses/home_200.txt') | |
# 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
# should be called 'Rakefile' | |
# | |
# Usage: | |
# rake response:capture url=http://google.com/ filename=google_200 | |
# rake response:capture url=http://google.com/404 filename=google_404 | |
require 'rubygems' | |
require 'net/http' | |
require 'uri' |
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
# Usage: | |
# rake response:capture url=http://google.com/ filename=google_200 | |
# rake response:capture url=http://google.com/404 filename=google_404 | |
require 'rubygems' | |
require 'net/http' | |
require 'uri' | |
namespace :response do |
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
# Prototype spider which uses 'bbc_standards' to test a whole website | |
require 'rubygems' | |
require 'anemone' | |
require 'bbc_standards' | |
require 'term/ansicolor' | |
class String | |
include Term::ANSIColor | |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Hello Glow</title> | |
<script src="glow/1.7.3/core/core.js" type="text/javascript"></script> | |
<script src="glow/1.7.3/widgets/widgets.js" type="text/javascript"></script> | |
<link href="glow/1.7.3/widgets/widgets.css" type="text/css" rel="stylesheet" /> |
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
// strip all slashes (ignored by search anyway) | |
var reVal = this.val().replace(/[\\\/]/,''); | |
// strip all non alpha-numeric (or space) chars too | |
reVal = reVal.replace(/[^a-zA-Z0-9 ]/,''); | |
// make a regexp to match before, 'val()' and after | |
var regex = new RegExp('(.*?)('+reVal+')(.*?)', 'i'); | |
// inject styling | |
name = name.replace(regex, '$1<span class="blq-search-underline">$2</span>$3'); |
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 | |
// this is the dependency injetion style stuff ... | |
class FlickrModel { | |
// first off, have some internal store for the object: | |
protected $_httpClient = null; | |
// have a method to get the object: |
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 pb = new PhoneBook('asdf.txt'); | |
pb.on('error', function(error) { | |
console.log(error); | |
}); | |
pb.on('data', function(data) { | |
console.log(data); | |
}); |
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 Cucumber | |
module Formatter | |
class Html | |
def initialize(step_mother, path_or_io, options) | |
end | |
def after_features | |
puts "original after_features" | |
end | |
end | |
end |
OlderNewer