This file contains hidden or 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
#!/usr/bin/env zsh | |
function resolve_symlink() { | |
local result=`readlink $1` | |
[ -z $result ] && echo $1 || $0 $result | |
} | |
function expand_path() { | |
cd -qP $1 | |
pwd |
This file contains hidden or 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
#! /bin/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/mongodb/bin | |
DAEMON=/opt/mongodb/bin/mongod | |
PIDFILE=/var/log/mongodb/mongodb.pid | |
LOGFILE=/var/log/mongodb/mongod.log | |
NAME=mongodb | |
DESC=mongodb | |
test -x $DAEMON || exit 0 |
This file contains hidden or 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
class HomeController < ApplicationController | |
def index | |
if (@target_url = params["url"]) && !@target_url.blank? | |
@target_url = @target_url =~ %r{^http://} ? @target_url : "http://#{@target_url}" | |
filter_if_length_less_than = 40 | |
@page = open(@target_url).read | |
doc = Nokogiri::HTML.parse(@page) | |
content = doc.search("h1,p,.comment") | |
content = content.reject { |node| node.text.gsub(/\W/,'').strip.length < filter_if_length_less_than } | |
content = content.reject { |node| (%w[noscript li] & node.ancestors.map { |e| e.name }).length > 0 } |
NewerOlder