Skip to content

Instantly share code, notes, and snippets.

View mrflip's full-sized avatar

Philip (flip) Kromer mrflip

View GitHub Profile
http://github.com/binarylogic/authlogic/tree/master
http://www.binarylogic.com/2008/11/21/tutorial-using-openid-with-authlogic
http://binarylogic.lighthouseapp.com/projects/18752-authlogic/tickets
http://github.com/mischa/auth_store/tree/master
http://github.com/josh/rack-openid/tree/master
--------------------
http://guides.rubyonrails.org/2_3_release_notes.html
http://weblog.rubyonrails.org/2009/1/26/nested-model-forms
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
http://gist.github.com/78393
// IE also doesn't set the accept headers correctly, so you have
// to request a file with the right extension (.js, probably).
// If you're not using one of the ruby remote form doodads,
// you'll want to ensure the form is sent to /widget/69.js
// and not the default /widget/69 :
// make forms do remote requests
jQuery.fn.submitWithAjax = function(){
this.submit(function () {
// Amend the URL for submitting this form to have a .js extension
module Wuclan::Models
#
# Text and metadata for a twitter status update
#
class Tweet < TypedStruct.new(
:id,
:created_at,
:twitter_user_id,
:favorited,
require 'wuclan/models/tweet/tweet_token'
require 'wukong/encoding'
module Wuclan::Models
Tweet.class_eval do
def string_for_tokenizing
# simpleminded test for non-latin script: don't bother if > 20 entities
return if (text.count('&') > 20)
# skip default message from early days
return if (text =~ /just setting up my twttr/);
# return decoded, whitespace-flattened text
module FreqUser
class Mapper < Wukong::Streamer::StructStreamer
#
# extract just the word
#
def process thing, &block
next unless thing.is_a? TweetToken
yield [thing.user_id, thing.word]
end
end
# Three more ways to cheat:
# Stack up all the values in a list then sum them at once:
require 'active_support/core_ext/enumerable'
class Reducer1 < Wukong::Streamer::ListReducer
def finalize
yield [ key, values.map(&:last).map(&:to_i).sum ]
end
end
module Wuclan::Models
#
# Text and metadata for a twitter status update
#
class Tweet < TypedStruct.new(
:id,
:created_at,
:twitter_user_id,
:favorited,
require 'wuclan/models/tweet/tweet_token'
require 'wukong/encoding'
module Wuclan::Models
Tweet.class_eval do
def string_for_tokenizing
# simpleminded test for non-latin script: don't bother if > 20 entities
return if (text.count('&') > 20)
# skip default message from early days
return if (text =~ /just setting up my twttr/);
# return decoded, whitespace-flattened text
@mrflip
mrflip / morbid.el
Created July 30, 2009 22:07
morbid.el
;;; morbid.el --- Morbid phrase utility for invoking the Gmail Ads pity setting.
;;
;; To use this:
;; Just before sending mail, do M-x morbid.
;;
;; A number of phrases will be inserted into your buffer, to help Gmail's Ad
;; Robot decide that this is an email about arranging your aunt's funeral and
;; thus the wrong place to see a Netflix Ad. Ho ho ho! We've so outsmarted
;; them! More like discretion is the better part of *Chumphood*!
<div class="toggle" id="news">
<!-- following will only be included if there are posts -->
{% for t in site.posts %} {% assign has_posts = true %}{% endfor %}{% if has_posts %}
<h2>{{ site.gemname | capitalize }} News</h2>
<ul class="posts">
{% for post in site.posts %}
<li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>