Skip to content

Instantly share code, notes, and snippets.

# can i do something like content.yield
# so i dont have to call content on each line of code?
def follow str
followers = @blog.followers
following = @blog.user.following_users
iterate_on_block str, followers, :Followers do |content,follower|
content.t_replace :FollowBlogName, follower.blog_name
content.t_replace :FollowProfileImage, follower.profile_image
$("#new-frame").load(function(){
$(this).load(function(){self.location.reload(true);});
});
<div class="info-box">
<div class="top-middle">
<div class="top">
<h2>Settings</h2>
<ul id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<li> <a href="#blog-settings">Blog Settings</a></li>
<li> <a href="#my-info">My Info</a></li>
<li> <a href="#theme">Theme</a></li>
</ul>
</div>
$('.unfollow-button').live('click',function(e){
var uid = this.id.match(/fol-(\d+)/)[1];
var button = this;
$.post("/unfollow/"+uid+"?ajax",{},function(data){
$(button).removeClass('.unfollow-button').addClass('.follow-button');
},'json');
return false;
});
selector
background-position = -3*!width -0*!height
&:hover
background-position = -3*!width -1*!height
&:active
background-position = -3*!width -2*!height
klass.replace_block(:matcher,[array,of,values]) do |scoped_klass,individual_value|
scoped_klass.my_method :foo, individual_value
end
require 'yaml'
module UserAgentFetures
class UserAgent
attr_accessor :string
yamlfile = File.join(File.dirname(__FILE__),'features.yaml')
features = YAML::load(File.open(yamlfile))
aliases = []
features.each do |feature,compatability|
#! /usr/bin/perl -w
#
# $Id: api.example.flush.txt 21976 2009-11-10 17:43:53Z ivanhoven $
#
# This is an example of using Panther Web Services APIs to flush
# objects from cache. Usage of the script is as follows:
#
# 1. Rename this example file to flush.pl and enable the execute bit.
#
# 2. Execute the script:
File.open(file_path).inject([]) do |result,line|
unless start_reading
start_reading =~ /ClosureCompiler/i
next result
end
break result if line =~ /\/ClosureCompiler/i
logic
class InfoCount < Sequel::Model
unrestrict_primary_key
class << self
def [](*args)
ret = super(*args)
if args.size == 1 && !ret && args.first
ret = create(:user_id => args.first)
end
ret