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
require 'feedzirra' | |
# fetching a single feed | |
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing") | |
# feed and entries accessors | |
feed.title # => "Paul Dix Explains Nothing" | |
feed.url # => "http://www.pauldix.net" | |
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing" | |
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0" |
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
require 'rubygems' | |
require 'activerecord' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'mysql', | |
:host => 'localhost', | |
:username => 'root', | |
:database => 'craigslist' | |
) | |
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
require 'sinatra/base' | |
run Sinatra.new { | |
get('/') do | |
content_type "text/plain" # you can also use Rack::ContentType | |
# with Sinatra except here we want | |
# more control since Sinatra gives it | |
# to us. Rack::ContentType sets the | |
# Content-Type on every route/url for | |
# the current mapping. |
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
#!/bin/bash | |
########################################################### | |
# TRIBUNE-SPECIFIC BUILD HOME script: | |
# This script sets up your home directory fast with basic | |
# necessities and amenities, to give you sanity when you | |
# work on a Unix box where you don't have root access. | |
########################################################### | |
# TO USE: | |
# curl https://raw.github.com/gist/259348/build_home.sh | bash | |
# OR: |
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
Just a informational gist if you plan to install "beanstalkd" via MacPorts and get a compiler error: | |
:info:build net.c: In function 'make_server_socket': | |
:info:build net.c:35: warning: 'fd' may be used uninitialized in this function | |
:info:build make[1]: *** [net.o] Error 1 | |
:info:build make[1]: *** Waiting for unfinished jobs.... | |
This is a known issue within the "net.c" file. I've found a diff[1] for said file on the web and applied it locally which then allowed me to install the port without problems. | |
If your install fails like: |
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
// Assumes you are using <html> conditional classes as described here: | |
// http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ | |
.lt-ie7 { | |
// blockquote small:before{content:'\2014 \00A0';} | |
blockquote small:before{content:"";} | |
// [class*="span"]{display:inline;float:left;margin-left:20px;} | |
.span1{display:inline;float:left;margin-left:20px;} | |
.span2{display:inline;float:left;margin-left:20px;} | |
.span3{display:inline;float:left;margin-left:20px;} | |
.span4{display:inline;float:left;margin-left:20px;} |
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
# This script watches for changes in a document and constantly resaves a file | |
# with the document's contents. | |
# | |
# Usage: coffee saver.coffee -d <DOCNAME> [--url http://somehost:8000/sjs] [-f filename] | |
client = require('share').client | |
fs = require('fs') | |
argv = require('optimist') | |
.usage('Usage: $0 -d docname [--url URL] [-f filename]') |
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
defmodule Phtest.OrientConnector do | |
use Jazz | |
@base_url "http://localhost:2480/" | |
@database "Phtest" | |
@user "admin" | |
@password "admin" | |
@basic_auth [basic_auth: {@user, @password}] | |
def get(document_id, type) do | |
OrientConnector.get_document(document_id) |
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
require 'serverspec' | |
require 'pathname' | |
require 'net/ssh' | |
include Serverspec::Helper::Ssh | |
include Serverspec::Helper::DetectOS | |
RSpec.configure do |c| | |
if ENV['ASK_SUDO_PASSWORD'] | |
require 'highline/import' |
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
describe "GET current" do | |
before do | |
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}" | |
get :current, :format => 'js' | |
end | |
it { should respond_with(:success) } | |
it { should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") } | |
it { should render_template('notices/current') } | |
end |
OlderNewer