I hereby claim:
- I am ericat on github.
- I am ericat (https://keybase.io/ericat) on keybase.
- I have a public key whose fingerprint is 68D1 A1C7 F9CD C013 A437 F0A5 080E 12A4 A1EB 63F8
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var _ = require('underscore'); // es6 can import what we need | |
// will return a function | |
function required(field, value) { | |
return value || 'Value is required'; | |
} | |
function minLen(value) { | |
return value.length >= 6 ? value : 'Value is too short'; | |
} |
'use strict' | |
var results = []; | |
function perm(list, memo) { | |
for(var i=0; i < list.length; i++) { | |
var current = list.splice(i,1)[0]; | |
if(list.length === 0) { | |
var permutation = memo.concat(current); |
import configureMockStore from 'redux-mock-store'; | |
import thunk from 'redux-thunk'; | |
import nock from 'nock'; | |
import expect from 'expect'; | |
import sinon from 'sinon'; | |
import * as actions from './actions'; | |
import * as types from './constants'; | |
const middlewares = [thunk]; | |
const mockStore = configureMockStore(middlewares); |
set nocompatible " be improved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Plugins | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'digitaltoad/vim-jade' |
require 'open-uri' | |
require 'nokogiri' | |
require 'benchmark' | |
url = 'http://stackoverflow.com/questions/8214299/xpath-or-css-parsing-faster-for-nokogiri-on-html-files' | |
page = Nokogiri::HTML(open(url)) | |
Benchmark.bmbm do |parser| | |
parser.report('Xpath') { 1000.times do page.at_xpath('//div[@id="sidebar"]//a[@class="question-hyperlink"]').text end } |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
url = 'http://www.greenmangaming.com/genres/action/' | |
doc = Nokogiri::HTML(open(url)) | |
File.open("scrape.txt", 'w') { |f| | |
doc.xpath('//h2').each do |item| | |
f.write "#{item.text}\n" |
require 'nokogiri' | |
require 'rubygems' | |
doc = Nokogiri::XML(File.open("path-to-file-sitemap.xml")) | |
doc.xpath('//xmlns:loc').each do |item| | |
puts item.text | |
end |
require 'rubygems' | |
require 'mechanize' | |
agent = Mechanize.new | |
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
page = agent.get('https://tradein.asda.com/Catalog/GetMakesForProductType?productTypeID=7') | |
puts page.content |
require 'rubygems' | |
require 'watir' | |
require 'headless' | |
class Watir_Scraper | |
def initialize(url) | |
@headless = Headless.new | |
@headless.start | |
@b = Watir::Browser.new | |
@b.goto(url) |