Skip to content

Instantly share code, notes, and snippets.

Sean Cribbs seancribbs

Block or report user

Report or block seancribbs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ehaml.erl
% -export([indentation_level/1, split_lines/1, strip_indentation/1, is_tag/1]).
-define(CR, 13).
-define(LF, 10).
-define(SPACE, 32).
-define(PERCENT, $%).
-define(APOS, $').
View twitter.erl
%%% File: twitter.erl
%%% @author Sean Cribbs <> []
%%% @copyright 2008 Sean Cribbs
%%% @doc Bindings for the Twitter API
%%% Include 'twitter.hrl' in your module to get the records.
%%% @end
%%% @since 2008-10-30 by Sean Cribbs
%%% @type auth() = {User::string(), Password::string()}
View gist:23361
19> twitter:search("#rubyconf"). ** exception error: function_clause
in function twitter:parse_twitter_time/1
in call from twitter:parse_search_result/1
in call from mochiweb_util:urlencode/1
in call from twitter:parse_search_results/1
in call from mochiweb_util:urlencode/1
View gen_phone.erl
%%% File: gen_phone.erl
%%% @author Sean Cribbs <> []
%%% @copyright 2009 Sean Cribbs
%%% @doc
%%% @end
%%% @since 2009-01-08 by Sean Cribbs
View gist:61628
def compare_user
%w{uid gid comment home shell password}.any? do |att|
!@new_resource.send(att).nil? && @new_resource.send(att) != @current_resource.send(att)
View gist:61761
DEBUG: /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:240:in `egid=': Operation not permitted (Errno::EPERM)
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:240:in `popen4'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:219:in `fork'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:219:in `popen4'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:164:in `run_command'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:153:in `chdir'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/mixin/command.rb:153:in `run_command'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/provider/execute.rb:48:in `action_run'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.5.3/lib/chef/runner.rb:87:in `send'
... 7 levels...
seancribbs / gist:62974
Created Feb 13, 2009
Erlang macro for automatically creating local mnesia tables for a record.
View gist:62974
% Damn record_info compilation
-define(create_table(RecordName),(fun() ->
mnesia:table_info(type, RecordName)
exit:_ ->
mnesia:create_table(RecordName, [{attributes, record_info(fields, RecordName)},
{type, ordered_set},
{disc_copies, [node()]}])
View gist:64915
h(Text) ->
html_escape("") -> "";
html_escape(Text) ->
WithoutAmp = re:replace(Text, "&", "\\&amp;", [global, {return, list}]),
WithoutLt = re:replace(WithoutAmp, "<", "\\&lt;", [global, {return, list}]),
WithoutGt = re:replace(WithoutLt, ">", "\\&gt;", [global, {return, list}]),
re:replace(WithoutGt, "\"", "\\&quot;", [global, {return, list}]).
seancribbs / mephisto_to_radiant.rb
Created Feb 19, 2009
Import Mephisto articles into Radiant via the API.
View mephisto_to_radiant.rb
require 'rubygems'
require '/path/to/radiant/api/lib/radiant/api' #
require 'activerecord'
"adapter" => "mysql",
"host" => "localhost",
"database" => "mephisto",
"username" => "***********",
"password" => "***********")
seancribbs / gist:67635
Created Feb 20, 2009 Atom feed generated by Radiant
View gist:67635
<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="" xml:lang="en-us">
<title type="text">Sean Cribbs</title>
<link rel="self" href="<r:url />" />
<link rel="alternate" type="text/html" href="" />
You can’t perform that action at this time.