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 is an awk script, but no awk colour coding is available here. | |
# | |
# input: an LDAP query pulling back the displayName and sAMAccountName properties | |
# for an entire ActiveDirectory forest | |
# | |
# output: yaml format of same data | |
# ex. | |
# 1: | |
# name: "Doll, Brian A" |
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
# Marcel Molina's REST/CRUD conventions | |
# http://project.ioni.st/post/2283#snippet_2283 | |
class ApplicationController < ActionController::Base | |
def self.set_resource(resource, &custom_setter) | |
filter_name = :"set_#{resource}" | |
before_filter filter_name, :only => [:show, :edit, :update, :destroy] | |
if custom_setter | |
define_method(filter_name) do |
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
s = Time.now | |
e = s + 100.days | |
i = s | |
dates = [] | |
dates << s | |
while i < e | |
i += 1.week | |
dates << i | |
end |
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
-- | |
-- convertMod2Dv.app | |
-- | |
-- a simple apple script applet to convert .mod files to .dv files | |
-- this is an essential step for those of us who own DV video cameras | |
-- that use this .mod file format, but would also like to edit those videos | |
-- in iMove HD or other editing apps. This applet was developed solely to | |
-- provide drag-n-drop functionality to the command line tool ffmpeg2. | |
-- It supports dragging individual files or folders of files, etc. | |
-- |
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
# Add unique header support to soap4r clients | |
# http://emphaticsolutions.com/index.php/2008/05/06/soap-headers-per-request-in-ruby/ | |
# | |
require 'soap/header/handlerset' | |
class SOAP::Header::HandlerSet | |
# resets the internal handler store to an empty representation | |
def reset | |
@store = XSD::NamedElements.new | |
end |
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
<%- cache "statulous_blog", (Time.now + 60.minutes) do -%> | |
<%= render_rss_feed("http://statulous.blogspot.com/feeds/posts/default?alt=rss") %> | |
<%- end -%> |
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 'rss/1.0' | |
require 'rss/2.0' | |
require 'open-uri' | |
require 'socket' | |
module ApplicationHelper | |
def render_rss_feed(url) | |
content = "" | |
open(url, 0) do |s| content = s.read end | |
feed = RSS::Parser.parse(content, false) |
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
<h3><a href='<%= @link %>'><%= @title %>:</a></h3> | |
<small>The most recent 5 entries:</small><br/> | |
<% @items.each do |item| %> | |
<li><strong><a href='<%= item.link %>'><%= item.title %></a></strong> - <small>(<%= item.date.strftime('%m/%d/%Y') %>)</small> | |
<% end %> |
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
%ruby script/console | |
Loading development environment (Rails 2.1.0) | |
>> (Time.now + 30.minutes).class | |
=> Time | |
>> 30.minutes.from_now.class | |
=> ActiveSupport::TimeWithZone |
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
public void testSnappyHappy() { | |
Map snappy = null; | |
Map happy = new HashMap(); | |
addToMap(snappy, "foo", "bar"); | |
addToMap(happy, "foo", "bar"); | |
} | |
private Map addToMap(Map map, String key, String value){ | |
if (map == null){ |
OlderNewer