View ehaml.erl
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
-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, $'). |
View twitter.erl
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
%%%------------------------------------------------------------------- | |
%%% 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()} |
View gist:23361
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
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
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
%%%------------------------------------------------------------------- | |
%%% File: gen_phone.erl | |
%%% @author Sean Cribbs <> [] | |
%%% @copyright 2009 Sean Cribbs | |
%%% @doc | |
%%% | |
%%% @end | |
%%% | |
%%% @since 2009-01-08 by Sean Cribbs | |
%%%------------------------------------------------------------------- |
View gist:61628
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
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 |
View gist:61761
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
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... |
View gist:62974
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
% 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 |
View gist:64915
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
h(Text) -> | |
html_escape(Text). | |
html_escape("") -> ""; | |
html_escape(Text) -> | |
WithoutAmp = re:replace(Text, "&", "\\&", [global, {return, list}]), | |
WithoutLt = re:replace(WithoutAmp, "<", "\\<", [global, {return, list}]), | |
WithoutGt = re:replace(WithoutLt, ">", "\\>", [global, {return, list}]), | |
re:replace(WithoutGt, "\"", "\\"", [global, {return, list}]). |
View mephisto_to_radiant.rb
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 '/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" => "***********") |
View gist:67635
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
<?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> | |
OlderNewer