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
class User | |
has_many :methods | |
has_many :options, :through => :methods | |
def points | |
connection.execute("SELECT SUM(points) as points FROM options o INNER JOIN methods m ON m.option_id = o.id WHERE m.user_id = '#{user_id}'").first['points'] | |
end | |
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
<div typeof="product:Product" | |
xmlns:product="http://search.yahoo.com/searchmonkey/product/" | |
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> | |
<span rel="rdfs:seeAlso media:image"> | |
<img src="http://www.sytore.com/product.jpg"/> | |
</span> | |
</div> | |
<div> | |
<span property="product:listPrice">49.99</span> | |
<span property="product:salePrice">39.99</span> |
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
#!/bin/sh | |
echo 'This script adds a slave to bind9' | |
echo '' | |
echo -n 'What is the TLD?: ' | |
read tld | |
echo -n 'What is the IP of the master server?: ' | |
read masterip | |
echo "zone \"$tld\" { | |
type slave; | |
file \"zones/slave/slave.$tld\"; |
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
source :rubygems | |
gem 'rails', '3.0.1' | |
gem 'sqlite3-ruby', :require => 'sqlite3' | |
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' | |
gem 'acts_as_commentable' | |
gem 'activemerchant' |
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
before_filter :strip_www | |
def strip_www | |
if request.env["HTTP_HOST"] == "www.myapp.com" | |
redirect_to "http://myapp.com/" | |
end | |
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
Refraction.configure do |req| | |
req.permanent! :host => "www.mydomain.com" if req.host !~ /^www./ | |
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
function updateCount() { | |
num--; | |
$('#status-count').html(num); | |
if (units == (1000 - num)) { | |
clearTimeout(countdown); | |
} | |
} | |
$(document).ready(function() { | |
$.getJSON('http://www.tweetfolk.com/markers/stats.js?callback=?', function(d) { |
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
We went out on the town last night | |
And drank to my friend's delight | |
i remember a shot | |
the rest i forgot | |
Lets do it again tonight! |
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
(function () { | |
function deleteAll() { | |
var list = $('ul#list'), | |
list_id = parseInt($(list[0]).attr('rel'), 10), | |
list_name = $('#list' + list_id + ' b').html(); | |
if (list_id > 0) { | |
if (confirm('Are you sure you want to delete all the items in ' + list_name)) { | |
list.find('li').each(function () { |
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
<script type="text/javascript"> | |
/* | |
Copyright (c) 2012 Jeremy Hubert (http://github.com/jhubert) | |
Released under the MIT License. See LICENSE for details. | |
*/ | |
(function(a){a.fn.GoogleizeForm=function(c){var f,e,d,b;d=a.extend({},a.fn.GoogleizeForm.defaults,c);b=function(g){var h;if(g===""){return false}h=d.emailRegex;return h.test(g)};f=function(h,i,g){return d.success()};e=function(i){var g,h;i.preventDefault();h=a(this);g=h.find(d.emailFieldSelector);if(!b(g.val())){d.invalidEmail(g);return false}c={};c.type="POST";c.dataType="jsonp";c.url=h.attr("action");c.data=h.serialize();c.error=f;a.ajax(c)};return this.each(function(){return a(this).on("submit",e)})};a.fn.GoogleizeForm.defaults={emailRegex:/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,emailFieldSelector:"#entry_0",success:function(){},invalidEmail:function(b){}}})(jQuery); | |
$(document).ready(function () { | |
$('form').GoogleizeForm({ | |
success: function () { |