Skip to content

Instantly share code, notes, and snippets.

-module(ehaml).
-compile(export_all).
% -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, $').
%%%-------------------------------------------------------------------
%%% File: twitter.erl
%%% @author Sean Cribbs <seancribbs@gmail.com> []
%%% @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()}
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
%%%-------------------------------------------------------------------
%%% File: gen_phone.erl
%%% @author Sean Cribbs <> []
%%% @copyright 2009 Sean Cribbs
%%% @doc
%%%
%%% @end
%%%
%%% @since 2009-01-08 by Sean Cribbs
%%%-------------------------------------------------------------------
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)
end
end
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
seancribbs / gist:62974
Created February 13, 2009 00:49
Erlang macro for automatically creating local mnesia tables for a record.
% Damn record_info compilation
-define(create_table(RecordName),(fun() ->
try
mnesia:table_info(type, RecordName)
catch
exit:_ ->
mnesia:create_table(RecordName, [{attributes, record_info(fields, RecordName)},
{type, ordered_set},
{disc_copies, [node()]}])
end
h(Text) ->
html_escape(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
seancribbs / mephisto_to_radiant.rb
Created February 19, 2009 16:38
Import Mephisto articles into Radiant via the API.
require 'rubygems'
require '/path/to/radiant/api/lib/radiant/api' # http://github.com/radiant/radiant-api
require 'activerecord'
ActiveRecord::Base.establish_connection(
"adapter" => "mysql",
"host" => "localhost",
"database" => "mephisto",
"username" => "***********",
"password" => "***********")
@seancribbs
seancribbs / gist:67635
Created February 20, 2009 19:10
seancribbs.com Atom feed generated by Radiant
<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us">
<title type="text">Sean Cribbs</title>
<link rel="self" href="http://seancribbs.com<r:url />" />
<link rel="alternate" type="text/html" href="http://seancribbs.com/" />
<id>http://seancribbs.com/</id>